This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: Fix for regrssion failure PR c++/28304


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" }
+}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]