This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/12615] [3.3 Regression] initializer syntax for POD structs gives parse error
- From: "gdr at integrable-solutions dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Oct 2003 16:23:19 -0000
- Subject: [Bug c++/12615] [3.3 Regression] initializer syntax for POD structs gives parse error
- References: <20031014193706.12615.bruno@clisp.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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