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

--- Comment #4 from Andrei Alexandrescu <[email protected]> ---
(In reply to Walter Bright from comment #2)
> Consider:
> 
>   struct S { ~this(); }
>   struct T { S s; }
> 
> The compiler will automatically create a destructor for T that will call the
> destructor for s, or will add code to do that to the destructor for T.
> 
>   union U { S1 a; S2 b; }
>   U u;
> 
> What happens to RIAA with this?

You mean RAII? There's none of it in unions. As I said, putting data in unions
automatically disables all automatic calls. Putting stuff in unions is purely
layout definition and manipulation. All calls must be inserted by the code
using the union (which is usually encapsulated in a struct wrapping the union
and providing discrimination).

--

Reply via email to