On Tue, 14 Aug 2012 22:32:58 +0200, Andrei Alexandrescu
<[email protected]> wrote:
On 8/14/12 3:25 PM, bearophile wrote:
D2 doesn't give you that restriction, and when an union goes out of
scope it calls the destructors of all its fields:
That's pretty surprising. "Major bug" doesn't begin to describe it.
Unions should call no constructors and no destructors.
That means the default case is unsafe. Should it also be an error
(or at least a warning) for a union containing types with destructors
or complex constructors not to have a defined constructor/destructor?
--
Simen