[Issue 15500] 'default construction is disabled for type' even though one should be available with default arg
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Jan 4 14:42:47 PST 2016
https://issues.dlang.org/show_bug.cgi?id=15500
Martin Nowak <code at dawg.eu> changed:
What |Removed |Added
----------------------------------------------------------------------------
Hardware|x86 |All
OS|Mac OS X |All
--- Comment #2 from Martin Nowak <code at dawg.eu> ---
According to Andrej it's supposed to be a warning only.
https://github.com/D-Programming-Language/dmd/pull/5185#issuecomment-168821489
But the changed code triggers an error due to a disabled constructor.
----
cat > bug.d << EOF
struct S {
this(string r = ".") {
}
}
void test() {
S s;
}
EOF
dmd -c -w bug
----
bug.d(2): Warning: constructor bug.S.this default constructor for structs only
allowed with @disable, no body, and no parameters
bug.d(7): Error: variable bug.test.s default construction is disabled for type
S
----
--
More information about the Digitalmars-d-bugs
mailing list