www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19321] New: Unions "may not" have fields with destructors


          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


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

Or just excise that entry altogether?

Oct 20 2018