]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/30535 (ICE with invalid template operator)
authorPaolo Carlini <pcarlini@suse.de>
Tue, 24 Jul 2007 09:18:39 +0000 (09:18 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 24 Jul 2007 09:18:39 +0000 (09:18 +0000)
/cp
2007-07-24  Paolo Carlini  <pcarlini@suse.de>

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

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

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

From-SVN: r126871

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

index 34c036f01c1752f8037a865e1b83fdcda75c5ac8..0cce9080c734ddc04de66da2ee93420b5938e716 100644 (file)
@@ -1,3 +1,8 @@
+2007-07-24  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/30535
+       * pt.c (unify): Never pass error_mark_node to template_decl_level.
+
 2007-07-19  Release Manager
 
        * GCC 4.2.1 released.
index 477265d49d0d5867221b072c3b6cbeb158a49b9c..2fe0337101ffde115089b25af9e9c287b8b20014 100644 (file)
@@ -10453,6 +10453,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 74d2930ecde07db1d12fe59c6bffb1367608782d..3c1d28444dc1b58426fd1b0d08dd96f6c5f3c7d6 100644 (file)
@@ -1,3 +1,8 @@
+2007-07-24  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/30535
+       * g++.dg/template/operator10.C: New.
+
 2007-07-21  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR fortran/32678
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" }