Hans Aberg ha scritto:
On 24 May 2009, at 16:13, Luca wrote:
C++ dont allow unions containing c++ classes
I think you're wrong. The size of a pointer is always known at
compile time, pair<const string,int>* it; is a pointer and not an
object. The size is 4 bytes using a 32 bit OS.
The problem is what the C++ standard really defines. I recall 'union's
can only contains POD (plain old data), which is defined as types
built from the C subset. The new C++ will extend this definition.
But you can use void* and cast to this type. The Bison type-system
does not work with proper C++ casting involving function calls anyway.
Hans
I successfully compiled a union containing pair<const string,int>* it;
using bison 2.4.1.
I think you can use pointers to C++ class inside a union without any
trouble. Just try it.
Luca
_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison