re PR c++/51403 (ICE with invalid template parameter)
authorJason Merrill <jason@redhat.com>
Thu, 12 Jan 2012 17:26:57 +0000 (12:26 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 12 Jan 2012 17:26:57 +0000 (12:26 -0500)
PR c++/51403
* pt.c (unify): Handle error_mark_node.

From-SVN: r183132

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

index b11d6bf2448c7ef908e0678001844f78bd645525..9af1a140d0da4eb2718b41b35d1f3baf5334a3a5 100644 (file)
@@ -1,3 +1,8 @@
+2012-01-12  Jason Merrill  <jason@redhat.com>
+
+       PR c++/51403
+       * pt.c (unify): Handle error_mark_node.
+
 2012-01-11  Jason Merrill  <jason@redhat.com>
 
        PR c++/51565
index ac72b6ddaaa521e3736a537aac6deedd6d7aab9e..97a92941c61da94eb65f0534df22983164671aa9 100644 (file)
@@ -16272,6 +16272,8 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict,
       idx = TEMPLATE_TYPE_IDX (parm);
       targ = TREE_VEC_ELT (INNERMOST_TEMPLATE_ARGS (targs), idx);
       tparm = TREE_VALUE (TREE_VEC_ELT (tparms, idx));
+      if (tparm == error_mark_node)
+       return unify_invalid (explain_p);
 
       /* Check for mixed types and values.  */
       if ((TREE_CODE (parm) == TEMPLATE_TYPE_PARM
index 56f28ee354b88233071d7e16706df02f7194594e..53dda864d66f3dac5491f0eed8e5260e9fe5dcf1 100644 (file)
@@ -1,3 +1,8 @@
+2012-01-12  Jason Merrill  <jason@redhat.com>
+
+       PR c++/51403
+       * g++.dg/template/arg8.C: New.
+
 2012-01-12  Ira Rosen  <irar@il.ibm.com>
 
        PR tree-optimization/51799
diff --git a/gcc/testsuite/g++.dg/template/arg8.C b/gcc/testsuite/g++.dg/template/arg8.C
new file mode 100644 (file)
index 0000000..adcd013
--- /dev/null
@@ -0,0 +1,7 @@
+template<typename T, void, typename U> // { dg-error "void" }
+void foo(T, U, int) {}
+
+void bar()
+{
+  foo(0, 0, 0);                        // { dg-error "no match" }
+}