[llvm-commits] RFC: initial union syntax support

Frits van Bommel fvbommel at wxs.nl
Wed May 13 01:18:39 PDT 2009

Nick Lewycky wrote:
> I really don't like allowing a union to contain the same type twice. 
> That should be illegal no matter what the object hierarchy is.

That would require the frontend to make sure different types being inserted into 
the union don't happen to have the same LLVM type.
For instance, 'int' and 'unsigned' are different in the frontend, but the same 
in LLVM. This is a simple case, but the same goes for more complicated struct 
types and such so in practice this would require some kind of hashset in the 
frontend, just to construct a union of arbitrary types.

Is there any actual harm in allowing it?

More information about the llvm-commits mailing list