diff options
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/init/array38.C | 8 |
3 files changed, 15 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 98bbcbd5a07..c3498605f81 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2015-01-23 Jason Merrill <jason@redhat.com> + PR c++/64314 + PR c++/57510 + * typeck2.c (split_nonconstant_init_1): Remove a sub-CONSTRUCTOR + that has been completely split out. + PR c++/64701 * constexpr.c (maybe_constant_value): Just hand back STATEMENT_LIST. diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index ddd30d19bc7..80a693981b3 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -653,6 +653,8 @@ split_nonconstant_init_1 (tree dest, tree init) if (!split_nonconstant_init_1 (sub, value)) complete_p = false; + else + CONSTRUCTOR_ELTS (init)->ordered_remove (idx--); num_split_elts++; } else if (!initializer_constant_valid_p (value, inner_type)) diff --git a/gcc/testsuite/g++.dg/init/array38.C b/gcc/testsuite/g++.dg/init/array38.C new file mode 100644 index 00000000000..bf097742d9b --- /dev/null +++ b/gcc/testsuite/g++.dg/init/array38.C @@ -0,0 +1,8 @@ +// PR c++/64314 +// { dg-do compile { target c++11 } } + +struct C { C(); ~C(); }; +struct A { + int i; + C c[1]; +} a {}; |