re PR c++/7939 (ICE on function template specialization)
authorKriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
Tue, 16 Sep 2003 15:27:51 +0000 (15:27 +0000)
committerKriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org>
Tue, 16 Sep 2003 15:27:51 +0000 (15:27 +0000)
PR c++/7939
* typeck.c (comptypes): Don't ICE when its first argument is
error_mark_node.
(compparms): Reverse the arguments of same_type_p.

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

From-SVN: r71432

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

index 980e655d0b319d7830ffafbb7dd17a404523ebad..5df525e3dc0a71acb22e9a36bc10db194a53b066 100644 (file)
@@ -1,3 +1,10 @@
+2003-09-16  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
+
+       PR c++/7939
+       * typeck.c (comptypes): Don't ICE when its first argument is
+       error_mark_node.
+       (compparms): Reverse the arguments of same_type_p.
+
 2003-09-15  Nathan Sidwell  <nathan@codesourcery.com>
 
        PR c++/12184
index 8f1171f8ee1f8c06ca85219226f82c2208477102..32447b6807bec83654fb45e9b972c5b07ca2390f 100644 (file)
@@ -900,11 +900,8 @@ comptypes (tree t1, tree t2, int strict)
   if (t1 == t2)
     return true;
 
-  /* This should never happen.  */
-  my_friendly_assert (t1 != error_mark_node, 307);
-
   /* Suppress errors caused by previously reported errors */
-  if (t2 == error_mark_node)
+  if (t1 == error_mark_node || t2 == error_mark_node)
     return false;
   
   my_friendly_assert (TYPE_P (t1) && TYPE_P (t2), 20030623);
@@ -1170,7 +1167,7 @@ compparms (tree parms1, tree parms2)
         they fail to match.  */
       if (!t1 || !t2)
        return false;
-      if (!same_type_p (TREE_VALUE (t2), TREE_VALUE (t1)))
+      if (!same_type_p (TREE_VALUE (t1), TREE_VALUE (t2)))
        return false;
     }
   return true;
index 9af03e7619c91dfd4f77fdd7d56225775d4c2904..e7cf798e7d8b07a91cf0f138224e133a7cd4b008 100644 (file)
@@ -1,3 +1,8 @@
+2003-09-16  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
+
+       PR c++/7939
+       * g++.dg/template/crash11.C: New test.
+
 2003-09-16  Jason Merrill  <jason@redhat.com>
            Jakub Jelinek  <jakub@redhat.com>
 
diff --git a/gcc/testsuite/g++.dg/template/crash11.C b/gcc/testsuite/g++.dg/template/crash11.C
new file mode 100644 (file)
index 0000000..3c69514
--- /dev/null
@@ -0,0 +1,9 @@
+// { dg-do compile }
+
+// Origin: kparz@iastate.edu
+
+// PR c++/7939: ICE for invalid function parameter after template
+// substitution.
+
+template <class T, class U> void foo(T, U) {}
+template <class T> void foo<T,void>(T, void) {} // { dg-error "incomplete|invalid|partial" }