PR c++/28110
authorreichelt <reichelt@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Jun 2006 09:47:51 +0000 (09:47 +0000)
committerreichelt <reichelt@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Jun 2006 09:47:51 +0000 (09:47 +0000)
* pt.c (unify) <case TEMPLATE_PARM_INDEX>: Check for invalid
parameters.

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114885 138bc75d-0d04-0410-961f-82ee72b054a4

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

index f666fab..ac044d1 100644 (file)
@@ -1,5 +1,9 @@
 2006-06-22  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
+       PR c++/28110
+       * pt.c (unify) <case TEMPLATE_PARM_INDEX>: Check for invalid
+       parameters.
+
        PR c++/28109
        * rtti.c (get_tinfo_decl_dynamic): Robustify.
 
index 08bda26..f7bc7ce 100644 (file)
@@ -10281,6 +10281,8 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict)
 
     case TEMPLATE_PARM_INDEX:
       tparm = TREE_VALUE (TREE_VEC_ELT (tparms, 0));
+      if (tparm == error_mark_node)
+       return 1;
 
       if (TEMPLATE_PARM_LEVEL (parm)
          != template_decl_level (tparm))
index d08e87c..a02dc4c 100644 (file)
@@ -1,5 +1,8 @@
 2006-06-22  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
+       PR c++/28110
+       * g++.dg/template/crash53.C: New test.
+
        PR c++/28109
        * g++.dg/rtti/incomplete1.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/template/crash53.C b/gcc/testsuite/g++.dg/template/crash53.C
new file mode 100644 (file)
index 0000000..bbd1e7f
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/28110
+// { dg-do compile }
+
+template<int> struct A {};
+
+template<typename T> struct B
+{
+  template<T I> B(A<I>);  // { dg-error "template constant parameter" }
+};
+
+B<double> a=A<0>();  // { dg-error "non-scalar type" }