www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9181] New: Forward reference error in struct static fields

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

           Summary: Forward reference error in struct static fields
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



This program compiles with no errors:

struct Foo {
    static immutable F = Foo();
    static immutable Foo[] foos1 = [F];
}
void main() {}




If I remove the type of foos1 it doesn't compile:

struct Foo {
    static immutable F = Foo();
    static immutable foos1 = [F];
}
void main() {}


DMD 2.061alpha gives:

test.d(3): Error: forward reference of variable F

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