aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2008-07-28 20:06:08 -0400
committerJason Merrill <jason@gcc.gnu.org>2008-07-28 20:06:08 -0400
commitb71836b0e4cd71a729e805db2916a4752a13adfa (patch)
tree385a9a7a087cc9defe8799053890beba7494362c /gcc/cp/decl.c
parent08df5d3e97297b19cb864922d367f4fe9b53bed2 (diff)
downloadgcc-b71836b0e4cd71a729e805db2916a4752a13adfa.zip
gcc-b71836b0e4cd71a729e805db2916a4752a13adfa.tar.gz
gcc-b71836b0e4cd71a729e805db2916a4752a13adfa.tar.bz2
re PR c++/36943 ([c++0x] Use of nested C++0x initializer list for non-aggregate rejected)
PR c++/36943 * decl.c (reshape_init_r): Allow C++0x initializer lists. From-SVN: r138221
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 630faac..2d9ccba 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -4786,15 +4786,20 @@ reshape_init_r (tree type, reshape_iter *d, bool first_initializer_p)
if (!CP_AGGREGATE_TYPE_P (type))
{
/* It is invalid to initialize a non-aggregate type with a
- brace-enclosed initializer.
+ brace-enclosed initializer before C++0x.
We need to check for BRACE_ENCLOSED_INITIALIZER_P here because
of g++.old-deja/g++.mike/p7626.C: a pointer-to-member constant is
a CONSTRUCTOR (with a record type). */
if (TREE_CODE (init) == CONSTRUCTOR
&& BRACE_ENCLOSED_INITIALIZER_P (init)) /* p7626.C */
{
- error ("braces around scalar initializer for type %qT", type);
- init = error_mark_node;
+ if (SCALAR_TYPE_P (type))
+ {
+ error ("braces around scalar initializer for type %qT", type);
+ init = error_mark_node;
+ }
+ else
+ maybe_warn_cpp0x ("extended initializer lists");
}
d->cur++;