[Issue 19321] New: Unions "may not" have fields with destructors
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Sat Oct 20 16:34:47 UTC 2018
    
    
  
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 at puremagic.com
          Reporter: stanislav.blinov at 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?
--
    
    
More information about the Digitalmars-d-bugs
mailing list