Bug 6330 – Cannot disable assignment to a struct.

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-07-15T20:07:00Z
Last change time
2011-11-14T13:32:55Z
Keywords
accepts-invalid, patch
Assigned to
nobody
Creator
dsimcha

Comments

Comment #0 by dsimcha — 2011-07-15T20:07:41Z
struct S { void opAssign(S s) @disable { assert(0); // This fails. } } void main() { S s; S s2; s2 = s; }
Comment #1 by k.hara.pg — 2011-11-13T06:28:58Z
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 }
Comment #2 by bugzilla — 2011-11-14T13:32:55Z