[Issue 7727] New: Immutable union instantiations too

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 18 06:00:38 PDT 2012


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

           Summary: Immutable union instantiations too
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2012-03-18 06:00:53 PDT ---
struct Foo1 {
    ushort bar2;
}
struct Foo2 {
    union  {
        ubyte[2] bar1;
        ushort bar2;
    }
}
void main() {
    immutable Foo1 foo1 = { bar2: 100 }; // OK
    immutable Foo2 foo2 = { bar2: 100 }; // error
}



DMD 2.059 gives:

test.d(12): Error: variable test.main.foo2 is not a static and cannot have
static initializer


(Maybe it's just a well known problem of unions not supported in CTFE?)

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