This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
questionable C error message for aggregate initializers?
- To: gcc at gcc dot gnu dot org
- Subject: questionable C error message for aggregate initializers?
- From: Ulrich Kunitz <gefm21 at uumail dot de>
- Date: Thu, 8 Nov 2001 23:46:29 +0100
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)