Test case:
struct Foo
{
invariant() { }
@disable this(this);
Foo bar()
{
Foo f;
return f;
}
}
When presented with the above, DMD complains:
bug.d(10): Error: struct bug.Foo is not copyable because it is annotated with @disable
If the struct invariant is removed, the code compiles just fine.