This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
(C++) shadow fix
- To: gcc-patches@gcc.gnu.org
- Subject: (C++) shadow fix
- From: Jason Merrill <jason@cygnus.com>
- Date: Thu, 5 Aug 1999 17:07:07 -0700
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. */