Comment #0 by snarwin+bugzilla — 2020-08-28T13:18:23Z
Example program:
---
struct A
{
this(ref A other) {}
}
struct B
{
A a;
}
void example()
{
B b1;
B b2 = b1;
}
---
Attempting to compile this results in the following error message:
onlineapp.d(14): Error: copy constructor onlineapp.B.this cannot be used because it is annotated with @disable
This is confusing, because there is no `@disable` annotation in the source code. The actual problem is that the compiler attempted to generate an `inout` copy constructor for B, but failed, because A's copy constructor only works for mutable instances of A.
Comment #1 by dlang-bot — 2020-09-18T04:14:39Z
@RazvanN7 created dlang/dmd pull request #11753 "Fix Issue 21204 - Error in generated copy constructor gives confusing message" fixing this issue:
- Fix Issue 21204 - Error in generated copy constructor gives confusing message
https://github.com/dlang/dmd/pull/11753
Comment #2 by dlang-bot — 2020-09-24T05:55:54Z
dlang/dmd pull request #11753 "Fix Issue 21204 - Error in generated copy constructor gives confusing message" was merged into master:
- b7e0b4a95f9683bc3ba7ac1b3ab8a72a1396d8f6 by RazvanN7:
Fix Issue 21204 - Error in generated copy constructor gives confusing message
https://github.com/dlang/dmd/pull/11753