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

[email protected] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #1 from [email protected] ---
This is caused by how D treats *anonymous* nested structs and unions - their
fields are correctly merged into the containing aggregate (alignment etc. is
fine), but the tail padding of that nested struct/union isn't applied to the
offsets of the following fields (which is most likely a bug).

I.e., this ugly workaround works as expected:

struct s {
    static union U { double d; char[20] cs; }
    U u;
    char b;
    alias u this;
}
pragma(msg, s.b.offsetof); // 24
pragma(msg, s.sizeof);     // 32

--

Reply via email to