Patch ping: Patch for PR c++/27495 regression bug

Steve Ellcey sje@cup.hp.com
Tue Jul 18 15:43:00 GMT 2006


Mark Mitchell wrote:

> I'd rather the robustification occur in
> adjust_result_of_qualified_name_lookup so that we can avoid having to
> fix any other callers.  Does that make sense, or am I being daft?

That makes sense.  Here is a new version of the patch, with the testing
in adjust_result_of_qualified_name_lookup.  Basically I changed the
assert into part of the initial if statement and, if that if statement
fails, nothing gets done in the routine.  The routine is already set up
to do nothing for other abnormal cases, so this seems like a reasonable
thing to do.  The resulting error message is the same as with the
earlier patch.

Retested on IA64 HP-UX and IA64.

OK for checkin?


2006-07-18  Steve Ellcey  <sje@cup.hp.com>

	PR c++/27495
	* search.c (adjust_result_of_qualified_name_lookup): Change
	assert to part of if statement.


Index: search.c
===================================================================
--- search.c	(revision 115540)
+++ search.c	(working copy)
@@ -1480,13 +1480,12 @@ adjust_result_of_qualified_name_lookup (
 					tree context_class)
 {
   if (context_class && context_class != error_mark_node
+      && CLASS_TYPE_P (context_class)
       && CLASS_TYPE_P (qualifying_scope)
       && DERIVED_FROM_P (qualifying_scope, context_class)
       && BASELINK_P (decl))
     {
       tree base;
-
-      gcc_assert (CLASS_TYPE_P (context_class));
 
       /* Look for the QUALIFYING_SCOPE as a base of the CONTEXT_CLASS.
 	 Because we do not yet know which function will be chosen by


2006-07-18  Steve Ellcey  <sje@cup.hp.com>

	PR c++/27495
	* g++.dg/other/pr27495.C: New.


Index: g++.dg/other/pr27495.C
===================================================================
--- g++.dg/other/pr27495.C	(revision 0)
+++ g++.dg/other/pr27495.C	(revision 0)
@@ -0,0 +1,8 @@
+
+// Test to make sure we do not ICE on this invalid program.
+
+struct A
+{
+    template<int> void foo();
+    void bar() { this.A::foo<0>(); }	// { dg-error "" }
+};



More information about the Gcc-patches mailing list