From: Steve Ellcey Date: Tue, 18 Jul 2006 17:25:40 +0000 (+0000) Subject: re PR c++/28304 (ICE looking up invalid member template) X-Git-Tag: releases/gcc-4.0.4~518 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=235ee106fde355c70597d623184de1eb830dc415;p=thirdparty%2Fgcc.git re PR c++/28304 (ICE looking up invalid member template) PR c++/28304 * decl2.c (check_classfn): Return NULL_TREE on error. * g++.dg/other/pr28304.C: New test. From-SVN: r115563 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 03438d522d46..babd2f41d73d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2006-07-18 Steve Ellcey + + PR c++/28304 + * decl2.c (check_classfn): Return NULL_TREE on error. + 2006-07-17 Lee Millward PR c++/28051 diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 776d8baabdaa..ca8c323071b0 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -707,8 +707,11 @@ check_classfn (tree ctype, tree function, tree template_parms) else if (!COMPLETE_TYPE_P (ctype)) cxx_incomplete_type_error (function, ctype); else - error ("no %q#D member function declared in class %qT", - function, ctype); + { + error ("no %q#D member function declared in class %qT", + function, ctype); + return NULL_TREE; + } /* If we did not find the method in the class, add it to avoid spurious errors (unless the CTYPE is not yet defined, in which diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fabfec9268d7..5f15fb089d56 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-07-18 Steve Ellcey + + PR c++/28304 + * g++.dg/other/pr28304.C: New test. + 2006-07-18 Volker Reichelt PR c/28286 diff --git a/gcc/testsuite/g++.dg/other/pr28304.C b/gcc/testsuite/g++.dg/other/pr28304.C new file mode 100644 index 000000000000..9a0e9cdd791c --- /dev/null +++ b/gcc/testsuite/g++.dg/other/pr28304.C @@ -0,0 +1,11 @@ + +// Test to make sure we do not ICE on this invalid program. + +struct A {}; + +template void A::foo(T) {} // { dg-error "" } + +void bar() +{ + A::foo(1); // { dg-error "not a member" } +}