digitalmars.D.bugs - [Issue 19321] New: Unions "may not" have fields with destructors
- d-bugmail puremagic.com (24/24) Oct 20 2018 https://issues.dlang.org/show_bug.cgi?id=19321
https://issues.dlang.org/show_bug.cgi?id=19321 Issue ID: 19321 Summary: Unions "may not" have fields with destructors Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dlang.org Assignee: nobody puremagic.com Reporter: stanislav.blinov gmail.com The spec (https://dlang.org/spec/struct.html#struct-destructor) says: "2. Unions may not have fields that have destructors." That's not true anymore, e.g. see https://issues.dlang.org/show_bug.cgi?id=16104 https://github.com/dlang/dmd/pull/5830 Perhaps, a better way to describe this in the spec is in order? E.g.: "2. Destructors are not automatically called for union fields. If destruction is desired, it must be explicit. For example, by adding a call `u.field.__xdtor`." Or just excise that entry altogether? --
Oct 20 2018