From 5973c7435193750d1ebbeb5753a0b0d480f95fc8 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 31 Aug 2007 09:44:54 +0000 Subject: [PATCH] re PR c++/32113 (ICE with invalid template parameter) /cp 2007-08-31 Paolo Carlini PR c++/32113 * search.c (lookup_member): Check the name argument for error_mark_node. /testsuite 2007-08-31 Paolo Carlini PR c++/32113 * g++.dg/template/crash70.C: New. From-SVN: r127963 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/search.c | 3 +++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/template/crash70.C | 7 +++++++ 4 files changed, 21 insertions(+) create mode 100644 gcc/testsuite/g++.dg/template/crash70.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9c7adc9ea96..eb814766436 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2007-08-31 Paolo Carlini + + PR c++/32113 + * search.c (lookup_member): Check the name argument for + error_mark_node. + 2007-08-31 Paolo Carlini PR c++/33212 diff --git a/gcc/cp/search.c b/gcc/cp/search.c index d5c57a9e546..4371eb4358e 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -1199,6 +1199,9 @@ lookup_member (tree xbasetype, tree name, int protect, bool want_type) const char *errstr = 0; + if (name == error_mark_node) + return NULL_TREE; + gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE); if (TREE_CODE (xbasetype) == TREE_BINFO) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f2d371404d6..134ea79cc4a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-08-31 Paolo Carlini + + PR c++/32113 + * g++.dg/template/crash70.C: New. + 2007-08-31 Paolo Carlini PR c++/33212 diff --git a/gcc/testsuite/g++.dg/template/crash70.C b/gcc/testsuite/g++.dg/template/crash70.C new file mode 100644 index 00000000000..742f77b2225 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash70.C @@ -0,0 +1,7 @@ +// PR c++/32113 + +template struct A; + +template void foo (A<&T::template i>); // { dg-error "not a template" } + +template void foo > (A<0>); // { dg-error "does not match" } -- 2.30.2