From fa4e8db234d50c36a3b410cccf4f10253f0ab1bd Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 23 Jan 2015 11:30:00 -0500 Subject: [PATCH] re PR c++/64314 (ICE in record_reference, at cgraphbuild.c:87) PR c++/64314 PR c++/57510 * typeck2.c (split_nonconstant_init_1): Remove a sub-CONSTRUCTOR that has been completely split out. From-SVN: r220047 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/typeck2.c | 2 ++ gcc/testsuite/g++.dg/init/array38.C | 8 ++++++++ 3 files changed, 15 insertions(+) create mode 100644 gcc/testsuite/g++.dg/init/array38.C 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 + 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 {}; -- 2.30.2