[Issue 19321] Unions "may not" have fields with destructors

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Oct 21 09:18:29 UTC 2018


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

Simen Kjaeraas <simen.kjaras at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simen.kjaras at gmail.com

--- Comment #1 from Simen Kjaeraas <simen.kjaras at gmail.com> ---
Definitely not excised - the fact that union member destructors should not be
called by the compiler is not immediately obvious, and the user should be
warned of this fact.

Also, the text should probably advocate destroy(u.field) over calling __xdtor
directly. Otherwise, your text looks good.

One related problem is issue 19122, or the fact that destructors are indeed
being called automatically for union members. That shouldn't affect this issue,
but it means that your text isn't correct until 19122 is fixed.

--


More information about the Digitalmars-d-bugs mailing list