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]

(C++) shadow fix


1999-08-05  Jason Merrill  <jason@yorick.cygnus.com>

	* decl.c (pushdecl): Only give an error for shadowing a parm 
	from *this* function.

Index: decl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl.c,v
retrieving revision 1.391
diff -c -p -r1.391 decl.c
*** decl.c	1999/08/04 09:07:47	1.391
--- decl.c	1999/08/06 00:06:42
*************** pushdecl (x)
*** 4118,4125 ****
  
  	  /* Warn if shadowing an argument at the top level of the body.  */
  	  else if (oldlocal != NULL_TREE && !DECL_EXTERNAL (x)
! 	      && TREE_CODE (oldlocal) == PARM_DECL
! 	      && TREE_CODE (x) != PARM_DECL)
  	    {
  	      /* Go to where the parms should be and see if we
  		 find them there.  */
--- 4118,4127 ----
  
  	  /* Warn if shadowing an argument at the top level of the body.  */
  	  else if (oldlocal != NULL_TREE && !DECL_EXTERNAL (x)
! 		   && TREE_CODE (oldlocal) == PARM_DECL
! 		   /* Don't complain if it's from an enclosing function.  */
! 		   && DECL_CONTEXT (oldlocal) == current_function_decl
! 		   && TREE_CODE (x) != PARM_DECL)
  	    {
  	      /* Go to where the parms should be and see if we
  		 find them there.  */

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