Skip to content

Fix issue 18586 - improve error message for disabled generated opAssign - #23818

Merged
thewilsonator merged 1 commit into
dlang:masterfrom
usefahmed07:fix-opassign-disable-msg-18586
Sep 9, 2026
Merged

Fix issue 18586 - improve error message for disabled generated opAssign#23818
thewilsonator merged 1 commit into
dlang:masterfrom
usefahmed07:fix-opassign-disable-msg-18586

Conversation

@usefahmed07

Copy link
Copy Markdown
Contributor

Fixes #18586

When a struct's generated opAssign is disabled because a field's
own opAssign is disabled, checkDisabled() previously reported the
generic 'generated function ... cannot be used because it is
annotated with @disable' message, without pointing to the actual
field responsible.

This mirrors the existing handling for disabled generated postblit
(bugzilla issue 21885) by walking the struct's fields and reporting
the first field whose opAssign is disabled, e.g.:

  Error: struct `S` is not assignable because field `f` is not assignable

Updated test/fail_compilation/disable.d to match the new message.
@thewilsonator
thewilsonator merged commit 9fbbb0f into dlang:master Sep 9, 2026
42 of 43 checks passed
@usefahmed07
usefahmed07 deleted the fix-opassign-disable-msg-18586 branch September 9, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[2.063] Fix for issue 3449 causes very unclear error messages

2 participants