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: PR c++/27495 - avoid ICE on invalid code.


This patch stops the parser from calling
adjust_result_of_qualified_name_lookup with a non-class type.  This
avoids the assert in adjust_result_of_qualified_name_lookup that happens
with non-class types.  A proper error is then given by
finish_class_member_access_expr.

Tested with no regressions on IA64 HP-UX.

OK for checkin?  Should I backport it to the 4.0 and 4.1 branches too?

Steve Ellcey
sje@cup.hp.com

2006-06-22  Steve Ellcey  <sje@cup.hp.com>

	PR c++/27495
	* cp/parser.c (cp_parser_postfix_dot_deref_expression): Do not
	call adjust_result_of_qualified_name_lookup with non-class type.


Index: cp/parser.c
===================================================================
--- cp/parser.c	(revision 114878)
+++ cp/parser.c	(working copy)
@@ -4535,7 +4535,7 @@ cp_parser_postfix_dot_deref_expression (
 	      parser->qualifying_scope = NULL_TREE;
 	      parser->object_scope = NULL_TREE;
 	    }
-	  if (scope && name && BASELINK_P (name))
+	  if (scope && CLASS_TYPE_P (scope) && name && BASELINK_P (name))
 	    adjust_result_of_qualified_name_lookup
 	      (name, BINFO_TYPE (BASELINK_BINFO (name)), scope);
 	  postfix_expression


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