This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/20103] [4.0/4.1 regression] ICE in create_tmp_var with C99 style struct initializer
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Mar 2005 12:16:06 -0000
- Subject: [Bug c++/20103] [4.0/4.1 regression] ICE in create_tmp_var with C99 style struct initializer
- References: <20050220111234.20103.falk@debian.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From joseph at codesourcery dot com 2005-03-05 12:15 -------
Subject: Re: [4.0/4.1 regression] ICE in create_tmp_var with
C99 style struct initializer
On Sat, 5 Mar 2005, giovannibajo at libero dot it wrote:
> It would probably also help to know why compound literals are lvalues in C99.
A compound literal is an unnamed variable (with automatic storage duration
associated with the enclosing block if within a function). That is,
(TYPE){ init }
effectively declares
TYPE var = { init };
with the initialization done when (each time) the literal is executed and
the literal then acting like var was named in the expression in which the
literal occurs. I'd guess this was the most natural model for permitting
in C
foo((int[]){ a, b, c, d, e });
with the array object living into and being usable in foo.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20103