[Issue 10186] default construction is disabled even if default ctor declared

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jan 7 06:07:23 PST 2015


https://issues.dlang.org/show_bug.cgi?id=10186

--- Comment #10 from Denis Shelomovskij <verylonglogin.reg at gmail.com> ---
Also one even can't create an array of class refereces:
---
struct S
{
    @disable this();
    this(int i) {}
}

class C
{
    S s;
    this() { s = S(1); }
}

void main()
{
    auto c = new C[1];  // line 15
}
---
main.d(15): Error: default construction is disabled for type main.C
---

Note:
This case is easily workaroundable e.g. setting `length` property.

--


More information about the Digitalmars-d-bugs mailing list