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]

C++ PATCH: Fix PR c++/13651


This PR is a case where we started issuing the same error message
twice on a single piece of code.  The patch makes us remember that
we've already seem something badly broken.

Tested on i686-pc-linux-gnu; applied on the mainline and on the
branch.

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2004-01-19  Mark Mitchell  <mark@codesourcery.com>

	PR c++/13651
	* parser.c (cp_parser_postfix_expression): When encountering
	incomplete type on left-hand side of "->" or ".", treat the entire
	expression as erroneous.

Index: cp/parser.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/parser.c,v
retrieving revision 1.158
diff -c -5 -p -r1.158 parser.c
*** cp/parser.c	19 Jan 2004 20:33:21 -0000	1.158
--- cp/parser.c	19 Jan 2004 22:07:41 -0000
*************** cp_parser_postfix_expression (cp_parser 
*** 3847,3856 ****
--- 3847,3861 ----
  		   discern that case, as opposed to the case where
  		   there was no SCOPE due to the type of expression
  		   being dependent.  */
  		if (!scope)
  		  scope = error_mark_node;
+ 		/* If the SCOPE was erroneous, make the various
+ 		   semantic analysis functions exit quickly -- and
+ 		   without issuing additional error messages.  */
+ 		if (scope == error_mark_node)
+ 		  postfix_expression = error_mark_node;
  	      }
  
  	    /* Consume the `.' or `->' operator.  */
  	    cp_lexer_consume_token (parser->lexer);
  	    /* If the SCOPE is not a scalar type, we are looking at an


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