[Issue 19917] unions should require that all members are `= void` initialised

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed May 29 19:16:27 UTC 2019


kinke at gmx.net changed:

           What    |Removed                     |Added
                 CC|                            |kinke at gmx.net

--- Comment #3 from kinke at gmx.net ---
I've just seen that LDC handles this differently than DMD. With LDC, an
explicit initializer takes precedence, regardless of the lexical order:

union S
    int x; // compiler error if also explicitly initialized (except for `=
    float y = 1.0f;

void main()
    S s;
    assert(s.y == 1.0f);


More information about the Digitalmars-d-bugs mailing list