This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c/7946: -std=gnu99 and casted empty srtuct initializers
- From: jsm28 at gcc dot gnu dot org
- To: bug-hurd at gnu dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, jsm28 at cam dot ac dot uk, marcus at gnu dot org, nobody at gcc dot gnu dot org
- Date: 17 Sep 2002 15:24:53 -0000
- Subject: Re: c/7946: -std=gnu99 and casted empty srtuct initializers
- Reply-to: jsm28 at gcc dot gnu dot org, bug-hurd at gnu dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, jsm28 at cam dot ac dot uk, marcus at gnu dot org, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
Synopsis: -std=gnu99 and casted empty srtuct initializers
State-Changed-From-To: open->closed
State-Changed-By: jsm28
State-Changed-When: Tue Sep 17 08:24:50 2002
State-Changed-Why:
This is deliberate. C99 compound literals are not
constant expressions but unnamed variables intitialized
in a given way. The code you give is equivalent to
foo_t compound_literal = { };
foo_t baz = compound_literal;
which of course fails. As an allowance for existing
code written for old GNU compound literals rather than
C99 compound literals (the Linux kernel), this case
is permitted in gnu89 mode but not gnu99 mode.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7946