[Bug c++/20103] [4.0/4.1 regression] ICE in create_tmp_var with C99 style struct initializer

joseph at codesourcery dot com gcc-bugzilla@gcc.gnu.org
Sat Mar 5 12:16:00 GMT 2005


------- 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



More information about the Gcc-bugs mailing list