re PR c++/28711 (ICE on invalid initializer for multidimensional array)
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Thu, 17 Aug 2006 08:02:39 +0000 (08:02 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Thu, 17 Aug 2006 08:02:39 +0000 (08:02 +0000)
PR c++/28711
* pt.c (tsubst_copy_and_build) <case CONSTRUCTOR>: Robustify.

* g++.dg/template/ctor8.C: New test.

From-SVN: r116210

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/ctor8.C [new file with mode: 0644]

index 7048c5f1411ecdf70bbcb6d613ac23c774abb8ba..650e393cbc0da68ea98b7142d5fbe252ce29bb44 100644 (file)
@@ -1,3 +1,8 @@
+2006-08-17  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/28711
+       * pt.c (tsubst_copy_and_build) <case CONSTRUCTOR>: Robustify.
+
 2006-08-17  Paolo Bonzini  <bonzini@gnu.org>
 
        PR c++/28573
index 27b6d111a26d8eeeb068b052b77176794a86ee3c..c9e28c85b1cfabf30ba48856c24e7dc8e8718edb 100644 (file)
@@ -9201,6 +9201,9 @@ tsubst_copy_and_build (tree t,
        tree type = tsubst (TREE_TYPE (t), args, complain, in_decl);
        bool process_index_p;
 
+       if (type == error_mark_node)
+         return error_mark_node;
+
        /* digest_init will do the wrong thing if we let it.  */
        if (type && TYPE_PTRMEMFUNC_P (type))
          return t;
index 624a2f23d73efa61cd5d4036acb77f3d38344840..6805eb1e6a32f92a14ae5473a64bc3f3f3f50898 100644 (file)
@@ -1,3 +1,8 @@
+2006-08-17  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/28711
+       * g++.dg/template/ctor8.C: New test.
+
 2006-08-17  Paolo Bonzini  <bonzini@gnu.org>
 
        * PR c++/28573
diff --git a/gcc/testsuite/g++.dg/template/ctor8.C b/gcc/testsuite/g++.dg/template/ctor8.C
new file mode 100644 (file)
index 0000000..859bded
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/28711
+// { dg-do compile }
+// { dg-options "" }
+
+template<int> struct A
+{
+  int x[1][1];
+  A() : x((int[1][]){{0}}) {}  // { dg-error "except the first" }
+};
+
+A<0> a;