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 to cp_parser_postfix_expression


We were failing to set idk to CP_PARSER_ID_KIND_QUALIFIED for the case of a
name qualified with both object and scope.  As a result, we were
incorrectly doing virtual lookup for some function calls.

Fixes g++.dg/overload/virtual1.C, a regression from 3.3.

Tested i686-pc-linux-gnu.  Mark, does this look like the right fix?

2003-02-12  Jason Merrill  <jason@redhat.com>

	* parser.c (cp_parser_postfix_expression): Set idk properly for
	object->scope::member.

*** parser.c.~1~	Wed Feb 12 14:07:26 2003
--- parser.c	Wed Feb 12 14:13:32 2003
*************** cp_parser_postfix_expression (cp_parser 
*** 4031,4036 ****
--- 4031,4037 ----
  	    parser->scope = NULL_TREE;
  	    parser->qualifying_scope = NULL_TREE;
  	    parser->object_scope = NULL_TREE;
+ 	    idk = CP_PARSER_ID_KIND_NONE;
  	    /* Enter the scope corresponding to the type of the object
  	       given by the POSTFIX_EXPRESSION.  */
  	    if (!dependent_p 
*************** cp_parser_postfix_expression (cp_parser 
*** 4095,4100 ****
--- 4096,4107 ----
                     Even though "t" is dependent, "X::f" is not and has 
  		   except that for a BASELINK there is no need to
  		   include scope information.  */
+ 
+ 		/* But we do need to remember that there was an explicit
+ 		   scope for virtual function calls.  */
+ 		if (parser->scope)
+ 		  idk = CP_PARSER_ID_KIND_QUALIFIED;
+ 
  		if (name != error_mark_node 
  		    && !BASELINK_P (name)
  		    && parser->scope)
*************** cp_parser_postfix_expression (cp_parser 
*** 4125,4131 ****
  	       object on the left-hand side of the `.' or `->'
  	       operator.  */
  	    parser->context->object_type = NULL_TREE;
- 	    idk = CP_PARSER_ID_KIND_NONE;
  	  }
  	  break;
  
--- 4132,4137 ----

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