This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

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


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


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