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++/12615] [3.3 Regression] initializer syntax for POD structs gives parse error


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12615



------- Additional Comments From gdr at integrable-solutions dot net  2003-10-15 16:23 -------
Subject: Re:  [3.3 Regression] initializer syntax for POD structs gives parse error

"bruno at clisp dot org" <gcc-bugzilla@gcc.gnu.org> writes:

[...]

|   // New ISO C 99 designated initializer syntax, without cast. 
|   { 
|     // As initializer - syntax error in g++. 
|     object a = { .one_o = 0, .allocstamp = 0 }; 
|     // As expression - syntax error in gcc and g++. 
|     object b; b = { .one_o = 0, .allocstamp = 0 }; 
|   } 
|   // New ISO C 99 designated initializer syntax, with cast. 
|   { 
|     // As initializer - syntax error in g++. 
|     object a = (object) { .one_o = 0, .allocstamp = 0 }; 
|     // As expression - syntax error in g++. 
|     object b; b = (object) { .one_o = 0, .allocstamp = 0 }; 
|   } 
| } 
| ========================================================= 
|  
| Which of the four syntaxes you recommend me to choose?


   object a = { 0, 0 }; // for C, C++

for initialization.

   object a;
   a = (object) { 0, 0 }; // for C, soon for C++

Fill a PR and put me on the CC list.

-- Gaby


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