This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
constructors in unions
- From: Corn Hulio <nitrogenycs at firemail dot de>
- To: gcc at gcc dot gnu dot org
- Date: Thu, 04 Dec 2003 19:56:21 +0100
- Subject: constructors in unions
Hello,
why isn't the following contruct possible?
union
{
Vector<float,3> pos;
struct
{
float x, y, z;
};
float p[3];
};
GCC gives me this error:
member `Vector<float, 3> <anonymous union>::pos' with constructor not
allowed in union
I guess in theory there should be no reason to disallow a member with
constructor in a union (as long as there is not more than 1 constructor).
Why doesn't that work? Or could one adopt gcc to make it work?
-Matt