[Issue 13495] New: DMD fails to call struct constructor with default args when default constructor is @disabled
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Sep 18 12:50:44 PDT 2014
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 at puremagic.com
Reporter: ketmar at 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.
--
More information about the Digitalmars-d-bugs
mailing list