On Mon, 21 Mar 2005, Hans Aberg wrote:
They should be OK in C++, as pointers do not have non-trival con-/de-structors. The compiler needs to see a declaration of the name as a type, though, before it sees the pointer.
If I remember correctly, it has to do with the size of the objects not being known at the time the `union' declaration is compiled. I'm not sure, but I think I tested this once and discovered, somewhat to my surprise, that using pointers in the `union' didn't work, either. When I get a chance, I'll check this carefully.
With unions, the problem is, if con-/de-structors are non-trivial, that it is impossible to know which ones to apply and when. The union does not contain any type information which field is selected. If one adds that, unions with non-trivial con-/de-Structors would be possible.
--
Hans Aberg
_______________________________________________ Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison