diff options
author | Jason Merrill <jason@redhat.com> | 2009-07-21 23:32:39 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2009-07-21 23:32:39 -0400 |
commit | 40b125d799aa684a563e1332db029f766defdb5c (patch) | |
tree | a224238e853cc036e9b85de034ed909f13859429 /gcc/cp/decl.c | |
parent | bd1f11bec9a0ada1f267a62dbb6c29e242141cd4 (diff) | |
download | gcc-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.c | 6 |
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++; |