This is the mail archive of the gcc-bugs@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]

Re: g++.law/operators24.C and --enable-checking=gcac



Zack --

  I think this patch will fix the bug you reported on
g++.law/operators24.C.  It changes the compiler to do name lookup by
DECL_NAME, not DECL_ASSEMBLER_NAME, which makes a lot more sense.
 
  Tested on i686-pc-linux-gnu.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

2000-06-07  Mark Mitchell  <mark@codesourcery.com>

	* decl.c (pushdecl): Look up functions by DECL_NAME, not
	DECL_ASSEMBLER_NAME.

Index: decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl.c,v
retrieving revision 1.627
diff -c -p -r1.627 decl.c
*** decl.c	2000/06/06 21:41:28	1.627
--- decl.c	2000/06/07 06:58:19
*************** pushdecl (x)
*** 3800,3806 ****
    my_friendly_assert (!cfun || doing_semantic_analysis_p (),
  		      19990913);
  
!   name = DECL_ASSEMBLER_NAME (x);
    need_new_binding = 1;
  
    if (DECL_TEMPLATE_PARM_P (x))
--- 3800,3806 ----
    my_friendly_assert (!cfun || doing_semantic_analysis_p (),
  		      19990913);
  
!   name = DECL_NAME (x);
    need_new_binding = 1;
  
    if (DECL_TEMPLATE_PARM_P (x))
*************** pushdecl (x)
*** 3853,3858 ****
--- 3853,3874 ----
  	t = namespace_binding (name, DECL_CONTEXT (x));
        else
  	t = lookup_name_current_level (name);
+ 
+       if (t && TREE_CODE (t) == OVERLOAD && TREE_CODE (x) == FUNCTION_DECL)
+ 	{
+ 	  tree match;
+ 
+ 	  for (match = t; match; match = OVL_NEXT (match))
+ 	    if (DECL_ASSEMBLER_NAME (OVL_CURRENT (t))
+ 		== DECL_ASSEMBLER_NAME (x))
+ 	      break;
+ 
+ 	  if (match)
+ 	    t = OVL_CURRENT (match);
+ 	  else
+ 	    t = NULL_TREE;
+ 	}
+ 
        if (t == error_mark_node)
  	{
  	  /* error_mark_node is 0 for a while during initialization!  */
*************** pushdecl (x)
*** 4057,4067 ****
  		 ordinary name are the same so we need not do this.  */
  	      && !DECL_EXTERN_C_FUNCTION_P (x))
  	    {
  	      if (TREE_CODE (x) == FUNCTION_DECL)
  		my_friendly_assert
! 		  ((IDENTIFIER_GLOBAL_VALUE (name) == NULL_TREE)
! 		  || (IDENTIFIER_GLOBAL_VALUE (name) == x), 378);
! 	      SET_IDENTIFIER_NAMESPACE_VALUE (name, x);
  	    }
  
  	  /* Don't forget if the function was used via an implicit decl.  */
--- 4073,4091 ----
  		 ordinary name are the same so we need not do this.  */
  	      && !DECL_EXTERN_C_FUNCTION_P (x))
  	    {
+ 	      tree mangled_name;
+ 
+ 	      if (TREE_CODE (x) == TYPE_DECL || TREE_CODE (x) == VAR_DECL
+ 		  || TREE_CODE (x) == NAMESPACE_DECL)
+ 		mangled_name = name;
+ 	      else
+ 		mangled_name = DECL_ASSEMBLER_NAME (x);
+ 
  	      if (TREE_CODE (x) == FUNCTION_DECL)
  		my_friendly_assert
! 		  ((IDENTIFIER_GLOBAL_VALUE (mangled_name) == NULL_TREE)
! 		  || (IDENTIFIER_GLOBAL_VALUE (mangled_name) == x), 378);
! 	      SET_IDENTIFIER_NAMESPACE_VALUE (mangled_name, x);
  	    }
  
  	  /* Don't forget if the function was used via an implicit decl.  */

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