This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch: Fix for regrssion failure PR c++/28304
- From: Steve Ellcey <sje at cup dot hp dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 14 Jul 2006 15:52:02 -0700 (PDT)
- Subject: Patch: Fix for regrssion failure PR c++/28304
- Reply-to: sje at cup dot hp dot com
Here is a fix and testcase for the regression PR c++/28304. I tested it
on IA64 HP-UX and Linux. The change I made to check_classfn matches
what grokfndecl does in returning NULL_TREE when this error is
encountered.
OK to checkin?
2006-07-14 Steve Ellcey <sje@cup.hp.com>
PR c++/28304
* decl2.c (check_classfn): Return NULL_TREE on error.
Index: decl2.c
===================================================================
--- decl2.c (revision 115430)
+++ decl2.c (working copy)
@@ -669,8 +669,11 @@ check_classfn (tree ctype, tree function
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
2006-07-14 Steve Ellcey <sje@cup.hp.com>
PR c++/28304
* g++.dg/other/pr28304.C: New test.
Index: g++.dg/other/pr28304.C
===================================================================
--- g++.dg/other/pr28304.C (revision 0)
+++ g++.dg/other/pr28304.C (revision 0)
@@ -0,0 +1,11 @@
+
+// Test to make sure we do not ICE on this invalid program.
+
+struct A {};
+
+template<typename T> void A::foo(T) {} // { dg-error "" }
+
+void bar()
+{
+ A::foo(1); // { dg-error "not a member" }
+}