https://issues.dlang.org/show_bug.cgi?id=16104
--- Comment #3 from Andrei Alexandrescu <[email protected]> --- (In reply to Walter Bright from comment #1) > 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? Forgot to mention Lois Goldthwaite's work on this: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf. It's a great fix of C++ without which implementing things like variant types portably was next to impossible. --
