aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1999-08-06 00:07:50 +0000
committerJason Merrill <jason@gcc.gnu.org>1999-08-05 20:07:50 -0400
commit9d29e7afe1d191b14c296cbcf72f53fdbaa46b95 (patch)
tree4e64295c6c3f8e12688b28149ce0a0007809ffee /gcc
parent75b36a2cc067ebfebcadcea0a7f2fbaa20639405 (diff)
downloadgcc-9d29e7afe1d191b14c296cbcf72f53fdbaa46b95.zip
gcc-9d29e7afe1d191b14c296cbcf72f53fdbaa46b95.tar.gz
gcc-9d29e7afe1d191b14c296cbcf72f53fdbaa46b95.tar.bz2
decl.c (pushdecl): Only give an error for shadowing a parm from *this* function.
* decl.c (pushdecl): Only give an error for shadowing a parm from *this* function. From-SVN: r28545
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl.c6
2 files changed, 9 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 488e441..19fe82d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 6702f2c..67b7108 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -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. */