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]

questionable C error message for aggregate initializers?


Hello,

gcc 3.0.2 compiles following code

	struct a { int n; };

	const struct a acv1 = { 1 };
	const struct a acv2 = acv1;

with the error message:

initializer.c:4: initializer element is not constant

Line 4 is indeed an invalid construct as specified in ISO/IEC 9899:1999
6.7.8:

16 Otherwise, the initializer for an object that has aggregate or union
   type shall be a brace-enclosed list of initializers for the elements
   or named members.

I think the error message is questionable in this case; it should be
"initializer is not a brace-enclosed list".

Regards,

Uli Kunitz

-- 
Ulrich Kunitz (gefm21@uumail.de)


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