decl.c (pushdecl): Only give an error for shadowing a parm from *this* function.
authorJason Merrill <jason@yorick.cygnus.com>
Fri, 6 Aug 1999 00:07:50 +0000 (00:07 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 6 Aug 1999 00:07:50 +0000 (20:07 -0400)
* decl.c (pushdecl): Only give an error for shadowing a parm
from *this* function.

From-SVN: r28545

gcc/cp/ChangeLog
gcc/cp/decl.c

index 488e44188faead6f2c9252be3908de252f84b953..19fe82d1dc9610225e8d628fffcebbd539fec126 100644 (file)
@@ -1,3 +1,8 @@
+1999-08-05  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * decl.c (pushdecl): Only give an error for shadowing a parm 
+       from *this* function.
+
 Thu Aug  5 02:40:42 1999  Jeffrey A Law  (law@cygnus.com)
 
        * typeck2.c: Update URLs and mail addresses.
index 6702f2c5edbe3f5f8cd607a7f9312415a8afb5c4..67b71088deee86fdc0b19b34ff9c0818922f3c72 100644 (file)
@@ -4118,8 +4118,10 @@ pushdecl (x)
 
          /* 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)
+                  && 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.  */