[Issue 1432] Bogus "overlapping initialization" error with structs, unions, and member initializers

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 22 19:33:11 PDT 2009


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





------- Comment #1 from tomas at famolsen.dk  2009-04-22 21:33 -------
Another variation:

union S
{
    float[2] a;
    struct
    {
        union { float i = 1; float x; }
        union { float j = 2; float y; }
    }
}

$ dmd bar.d -c
bar.d(2): Error: union bar.S overlapping initialization for struct S.i
bar.d(2): Error: union bar.S overlapping initialization for struct S.j

If 'a' is moved below the anonymous struct it works. The spec does not mention
this special case as far as I can tell. Explicit initialization of aggregate
fields inside anonymous struct/union combinations should be documented.


-- 



More information about the Digitalmars-d-bugs mailing list