From: Kriang Lerdsuwanakij Date: Tue, 16 Sep 2003 15:27:51 +0000 (+0000) Subject: re PR c++/7939 (ICE on function template specialization) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ae8803a8e1d21a5813775816ae915f4ccd92d6c5;p=gcc.git re PR c++/7939 (ICE on function template specialization) 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 980e655d0b3..5df525e3dc0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2003-09-16 Kriang Lerdsuwanakij + + 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 PR c++/12184 diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 8f1171f8ee1..32447b6807b 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9af03e7619c..e7cf798e7d8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-09-16 Kriang Lerdsuwanakij + + PR c++/7939 + * g++.dg/template/crash11.C: New test. + 2003-09-16 Jason Merrill Jakub Jelinek diff --git a/gcc/testsuite/g++.dg/template/crash11.C b/gcc/testsuite/g++.dg/template/crash11.C new file mode 100644 index 00000000000..3c69514e243 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash11.C @@ -0,0 +1,9 @@ +// { dg-do compile } + +// Origin: kparz@iastate.edu + +// PR c++/7939: ICE for invalid function parameter after template +// substitution. + +template void foo(T, U) {} +template void foo(T, void) {} // { dg-error "incomplete|invalid|partial" }