struct S { void opAssign(S s) @disable { assert(0); // This fails. } } void main() { S s; S s2; s2 = s; }
https://github.com/D-Programming-Language/dmd/pull/508 This is parser issue, that the postfix @disable attribute is ignored. The workaround is moving @disable into head. struct S { @disable void opAssign(S s){ assert(0); // This fails. } } void main() { S s; S s2; s2 = s; // Error: function test.S.opAssign is not callable because it is annotated with @disable }
https://github.com/D-Programming-Language/dmd/commit/f0e2b4950e23c34ec32e4c3b20c7f77639a70673