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

RazvanN <[email protected]> changed:

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

--- Comment #6 from RazvanN <[email protected]> ---
Spec:

"If there are anonymous unions in the struct, only the first member of the
anonymous union can be initialized with a struct literal, and all subsequent
non-overlapping fields are default initialized." [1]

[1] https://dlang.org/spec/struct.html#struct-literal

The error is therefore correctly issued, however the error message can be
improved. Currently, "overlapping initialization for r" does not hint at all
how the issue can be fixed.

A better workaround would be to have the union as the last field of the struct
and then initialize it as S(p, a);

--

Reply via email to