[Issue 13891] New: __gshared/static union members do not overlap

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Dec 25 00:48:15 PST 2014


https://issues.dlang.org/show_bug.cgi?id=13891

          Issue ID: 13891
           Summary: __gshared/static union members do not overlap
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: vlevenfeld at gmail.com

struct Foo
{
    union {
        int a;
        int b;
    }
}
struct Bar
{
    __gshared union { // also fails if __gshared -> static
        int a;
        int b;
    }
}
void main (string[] args)
{
    Foo x; Bar y;

    assert (cast(uint)(&x.a) == cast(uint)(&x.b)); // PASS
    assert (cast(uint)(&y.a) == cast(uint)(&y.b)); // FAIL
}

--


More information about the Digitalmars-d-bugs mailing list