[Issue 10099] New: Diagnostic for disable default construction should improve

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 16 19:05:07 PDT 2013


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

           Summary: Diagnostic for disable default construction should
                    improve
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-05-16 19:05:06 PDT ---
-----
struct S
{
    int x;
    @disable this();
    this(int x) { }
}

void main()
{
    S s;  // L12
}
-----

> test.d(12): Error: variable test.main.s initializer required for type S

This should really be:

> test.d(12): Error: struct test.S cannot be default-initialized because it has a default constructor annotated with @disable

This would be similar to:

-----
struct S
{
    @disable this(this);
}

void main()
{
    S s;
    S s2 = s;
}
-----

> test.d(11): Error: struct test.S is not copyable because it is annotated with @disable

-- 
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