[Issue 7094] New: More initializers than struct fields for static member creation

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 11 02:32:38 PST 2011


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

           Summary: More initializers than struct fields for static member
                    creation
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2011-12-11 02:32:31 PST ---
D2 code:

struct Foo {
    static f = Foo(0); // line 2
    int x;
}
void main() {}



DMD 2.057beta refuses it, but I think it's correct code:

test.d(2): Error: more initializers than fields of Foo


Workaround: define 'f' after x:


struct Foo {
    int x;
    static f = Foo(0); // line 2
}
void main() {}

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