re PR c++/64314 (ICE in record_reference, at cgraphbuild.c:87)
authorJason Merrill <jason@redhat.com>
Fri, 23 Jan 2015 16:30:00 +0000 (11:30 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 23 Jan 2015 16:30:00 +0000 (11:30 -0500)
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
gcc/cp/typeck2.c
gcc/testsuite/g++.dg/init/array38.C [new file with mode: 0644]

index 98bbcbd..c349860 100644 (file)
@@ -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.
 
index ddd30d1..80a6939 100644 (file)
@@ -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 (file)
index 0000000..bf09774
--- /dev/null
@@ -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 {};