digitalmars.D.bugs - [Issue 12764] New: Disabled struct default construction circumvented
- via Digitalmars-d-bugs (38/38) May 18 2014 https://issues.dlang.org/show_bug.cgi?id=12764
https://issues.dlang.org/show_bug.cgi?id=12764 Issue ID: 12764 Summary: Disabled struct default construction circumvented when field is written to Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: accepts-invalid Severity: major Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: andrej.mitrovich gmail.com ----- struct S { disable this(); this(string) { } int f; } class C { this(int) { s.f = 1; // circumvents default ctor! } S s; } void main() { } ----- If we comment out writing to 'f' we get: test.d(11): Error: constructor test.C.this field s must be initialized in constructor This should always be emitted unless we explicitly call "s = S(...)" or "s = S.init". --
May 18 2014