September 18, 2014 [Issue 13495] New: DMD fails to call struct constructor with default args when default constructor is @disabled | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13495 Issue ID: 13495 Summary: DMD fails to call struct constructor with default args when default constructor is @disabled Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: DMD Assignee: nobody@puremagic.com Reporter: ketmar@ketmar.no-ip.org i think that calling struct constructor with omited default parameters should be allowed even if struct has @disable this(). i.e. the following code should work: struct S { int v; @disable this (); this (int n=42) { v = n; } } void main () { auto s = S(); } now compiler complains: "Error: constructor z03.S.this is not callable because it is annotated with @disable". but here is another constructor that perfectly fits. -- |
Copyright © 1999-2021 by the D Language Foundation