re PR c++/30535 (ICE with invalid template operator)
authorPaolo Carlini <pcarlini@suse.de>
Sun, 8 Jul 2007 22:41:12 +0000 (22:41 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sun, 8 Jul 2007 22:41:12 +0000 (22:41 +0000)
/cp
2007-07-08  Paolo Carlini  <pcarlini@suse.de>

PR c++/30535
* pt.c (unify): Never pass error_mark_node to template_decl_level.

/testsuite
2007-07-08  Paolo Carlini  <pcarlini@suse.de>

PR c++/30535
* g++.dg/template/operator10.C: New.

From-SVN: r126470

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

index 2526a43ff0328419c21608282b8a828af27ad143..24a47637203f047655d27e88dc299b9f24b11801 100644 (file)
@@ -1,3 +1,8 @@
+2007-07-08  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/30535
+       * pt.c (unify): Never pass error_mark_node to template_decl_level.
+
 2007-07-07  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/32232
index 06e94e74fdb7933535e8f3e0f2759b426c329cbe..38a4c09d6159bb822c6a77d65b2a6aa7449092cd 100644 (file)
@@ -12298,6 +12298,8 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict)
     case TEMPLATE_TEMPLATE_PARM:
     case BOUND_TEMPLATE_TEMPLATE_PARM:
       tparm = TREE_VALUE (TREE_VEC_ELT (tparms, 0));
+      if (tparm == error_mark_node)
+       return 1;
 
       if (TEMPLATE_TYPE_LEVEL (parm)
          != template_decl_level (tparm))
index 4f24f50eb4848a240badc02037c41ea2a0ec5717..66749ecd75d8cdb5be3b1bb7c9b010328b3f34e7 100644 (file)
@@ -1,3 +1,8 @@
+2007-07-08  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/30535
+       * g++.dg/template/operator10.C: New.
+
 2007-07-08  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR libfortran/32217
diff --git a/gcc/testsuite/g++.dg/template/operator10.C b/gcc/testsuite/g++.dg/template/operator10.C
new file mode 100644 (file)
index 0000000..b17f49f
--- /dev/null
@@ -0,0 +1,7 @@
+// PR c++/30535
+
+struct A {};
+
+template<A, typename T> int operator-(A, T); // { dg-error "not a valid type" }
+
+int i = A() - 0; // { dg-error "no match" }