[Issue 16104] Unions should allow fields with destructors, postblits, and invariants

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon May 30 20:40:25 PDT 2016


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

Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla at digitalmars.com

--- Comment #1 from Walter Bright <bugzilla at digitalmars.com> ---
In C++:

  struct S {  ~S(); };
  union U  { S s; };

g++ -c foo.cpp
foo.cpp:2:14: error: member 'S U::s' with destructor not allowed in union
 union U  { S s; };
              ^
foo.cpp:2:14: note: unrestricted unions only available with -std=c++11 or
-std=gnu++11


What was C++11's rationale?

--


More information about the Digitalmars-d-bugs mailing list