[Bug c++/12615] [3.3 Regression] initializer syntax for POD structs gives parse error

gdr at integrable-solutions dot net gcc-bugzilla@gcc.gnu.org
Wed Oct 15 16:23:00 GMT 2003


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



More information about the Gcc-bugs mailing list