This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]