[Issue 8118] New: Impossible to initialize a member struct without default constructor or assigment

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 18 17:03:45 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8118

           Summary: Impossible to initialize a member struct without
                    default constructor or assigment
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: wfunction at hotmail.com


--- Comment #0 from wfunction at hotmail.com 2012-05-18 17:05:19 PDT ---
struct S
{
    @disable this();
    this(int) { }
    @disable void opAssign(typeof(this));
}

class Test
{
    S s = void;      // I *EXPLICITLY* told it not to be initialized, but...
    this() { s = S(to!int("1")); }
}

void main() { new Test(); }


Error: function S.opAssign is not callable because it is annotated with
@disable
Error: default construction is disabled for type Test



Structs without default constructors are pretty much impossible to use.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list