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]

initialising anonymous unions


Should the following compile?

	struct wibble {
		int	a;
		int	b;
		int	c;
		union {
			int	x;
			void	*y;
		};
	};

	struct wibble fred = {
		.a	= 1,
		.b	= 2,
		.c	= 3,
		.x	= 1234,
	};

Or is there some other way to refer to x or y?

What I see is:

	dhowells>gcc -s union.c 
	union.c:15: unknown field `x' specified in initializer

David


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