aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2009-07-21 23:32:39 -0400
committerJason Merrill <jason@gcc.gnu.org>2009-07-21 23:32:39 -0400
commit40b125d799aa684a563e1332db029f766defdb5c (patch)
treea224238e853cc036e9b85de034ed909f13859429 /gcc/cp/decl.c
parentbd1f11bec9a0ada1f267a62dbb6c29e242141cd4 (diff)
downloadgcc-40b125d799aa684a563e1332db029f766defdb5c.zip
gcc-40b125d799aa684a563e1332db029f766defdb5c.tar.gz
gcc-40b125d799aa684a563e1332db029f766defdb5c.tar.bz2
decl.c (reshape_init_r): { T } is not an aggregate initializer for class T.
* decl.c (reshape_init_r): { T } is not an aggregate initializer for class T. From-SVN: r149874
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 6fa9428..7f4509e 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -4878,7 +4878,7 @@ reshape_init_class (tree type, reshape_iter *d, bool first_initializer_p)
a CONSTRUCTOR). TYPE is the type of the variable being initialized, D is the
iterator within the CONSTRUCTOR which points to the initializer to process.
FIRST_INITIALIZER_P is true if this is the first initializer of the
- CONSTRUCTOR node. */
+ outermost CONSTRUCTOR node. */
static tree
reshape_init_r (tree type, reshape_iter *d, bool first_initializer_p)
@@ -4923,6 +4923,10 @@ reshape_init_r (tree type, reshape_iter *d, bool first_initializer_p)
initializer is considered for the initialization of the first
member of the subaggregate. */
if (TREE_CODE (init) != CONSTRUCTOR
+ /* But don't try this for the first initializer, since that would be
+ looking through the outermost braces; A a2 = { a1 }; is not a
+ valid aggregate initialization. */
+ && !first_initializer_p
&& can_convert_arg (type, TREE_TYPE (init), init, LOOKUP_NORMAL))
{
d->cur++;