public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/50563] New: Weird syntax acceptance rules for non-static data members initialized in place (C++0x)
@ 2011-09-29 8:19 ethouris at gmail dot com
2011-09-29 8:20 ` [Bug c++/50563] " redi at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: ethouris at gmail dot com @ 2011-09-29 8:19 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50563
Bug #: 50563
Summary: Weird syntax acceptance rules for non-static data
members initialized in place (C++0x)
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: ethouris@gmail.com
In the latest version it's possible to initialize data in place.
According to the standard, non-static data members can be initialized with:
int a = 0;
or
int a {0};
and not with the constructor syntax:
int a (0);
However there are probably no strict rules how the "list of variables" can be
initialized. I state that it should be normally allowed. Actually gcc accepts
the following syntax:
int a {10}, b {20};
as well as:
int a, b = 20;
but this one:
int a = 10, b = 20;
ends up with the following error message:
error: expected ‘;’ before ‘,’ token
I'm not completely sure, but it should be just strict rule: either the list of
variables syntax is not allowed when the variables are also initialized (so int
a,b=20; should fail too), or the list of variables syntax should be supported
as usual.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/50563] Weird syntax acceptance rules for non-static data members initialized in place (C++0x)
2011-09-29 8:19 [Bug c++/50563] New: Weird syntax acceptance rules for non-static data members initialized in place (C++0x) ethouris at gmail dot com
@ 2011-09-29 8:20 ` redi at gcc dot gnu.org
2011-10-09 9:16 ` [Bug c++/50563] [C++0x] Weird syntax acceptance rules for non-static data members initialized in place paolo.carlini at oracle dot com
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2011-09-29 8:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50563
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-09-29 07:55:55 UTC ---
struct S1 {
int a{10}, b{20}; // OK
};
struct S2 {
int a, b = 20; // OK
};
struct S3 {
int a = 10, b = 20; // Error
};
CCing Jason
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/50563] [C++0x] Weird syntax acceptance rules for non-static data members initialized in place
2011-09-29 8:19 [Bug c++/50563] New: Weird syntax acceptance rules for non-static data members initialized in place (C++0x) ethouris at gmail dot com
2011-09-29 8:20 ` [Bug c++/50563] " redi at gcc dot gnu.org
@ 2011-10-09 9:16 ` paolo.carlini at oracle dot com
2011-10-13 21:51 ` jason at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-09 9:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50563
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |miles at gnu dot org
--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-09 09:15:17 UTC ---
*** Bug 50671 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/50563] [C++0x] Weird syntax acceptance rules for non-static data members initialized in place
2011-09-29 8:19 [Bug c++/50563] New: Weird syntax acceptance rules for non-static data members initialized in place (C++0x) ethouris at gmail dot com
2011-09-29 8:20 ` [Bug c++/50563] " redi at gcc dot gnu.org
2011-10-09 9:16 ` [Bug c++/50563] [C++0x] Weird syntax acceptance rules for non-static data members initialized in place paolo.carlini at oracle dot com
@ 2011-10-13 21:51 ` jason at gcc dot gnu.org
2011-10-14 19:13 ` jason at gcc dot gnu.org
2011-10-14 19:22 ` jason at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2011-10-13 21:51 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50563
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2011-10-13
AssignedTo|unassigned at gcc dot |jason at gcc dot gnu.org
|gnu.org |
Ever Confirmed|0 |1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/50563] [C++0x] Weird syntax acceptance rules for non-static data members initialized in place
2011-09-29 8:19 [Bug c++/50563] New: Weird syntax acceptance rules for non-static data members initialized in place (C++0x) ethouris at gmail dot com
` (2 preceding siblings ...)
2011-10-13 21:51 ` jason at gcc dot gnu.org
@ 2011-10-14 19:13 ` jason at gcc dot gnu.org
2011-10-14 19:22 ` jason at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2011-10-14 19:13 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50563
--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2011-10-14 19:13:05 UTC ---
Author: jason
Date: Fri Oct 14 19:12:57 2011
New Revision: 180003
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=180003
Log:
PR c++/50563
* parser.c (cp_parser_cache_group): Handle end==CPP_COMMA.
(cp_parser_save_nsdmi): Pass it.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/nsdmi-list1.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/parser.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/50563] [C++0x] Weird syntax acceptance rules for non-static data members initialized in place
2011-09-29 8:19 [Bug c++/50563] New: Weird syntax acceptance rules for non-static data members initialized in place (C++0x) ethouris at gmail dot com
` (3 preceding siblings ...)
2011-10-14 19:13 ` jason at gcc dot gnu.org
@ 2011-10-14 19:22 ` jason at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2011-10-14 19:22 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50563
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.7.0
--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2011-10-14 19:21:45 UTC ---
Fixed.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-10-14 19:22 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-29 8:19 [Bug c++/50563] New: Weird syntax acceptance rules for non-static data members initialized in place (C++0x) ethouris at gmail dot com
2011-09-29 8:20 ` [Bug c++/50563] " redi at gcc dot gnu.org
2011-10-09 9:16 ` [Bug c++/50563] [C++0x] Weird syntax acceptance rules for non-static data members initialized in place paolo.carlini at oracle dot com
2011-10-13 21:51 ` jason at gcc dot gnu.org
2011-10-14 19:13 ` jason at gcc dot gnu.org
2011-10-14 19:22 ` jason at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).