summaryrefslogtreecommitdiff
path: root/gcc/cp/name-lookup.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-14 17:04:04 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-14 17:04:04 +0000
commit18a20006d0f6a6c6061542dd2d2e2522d25e9d35 (patch)
tree76e3155ad284843c0ee3e67ab11f815fcc73029e /gcc/cp/name-lookup.c
parent11964566ad7690c109fcd0568fdcfe19343b7a3e (diff)
downloadgcc-18a20006d0f6a6c6061542dd2d2e2522d25e9d35.tar.gz
PR c++/39763
* name-lookup.c (pushdecl_maybe_friend): Avoid all warnings about shadowing by tentative parms. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146053 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/name-lookup.c')
-rw-r--r--gcc/cp/name-lookup.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 2eebb79f278..b47c0c55fd8 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -1008,13 +1008,18 @@ pushdecl_maybe_friend (tree x, bool is_friend)
&& TREE_PUBLIC (x))
TREE_PUBLIC (name) = 1;
+ /* Don't complain about the parms we push and then pop
+ while tentatively parsing a function declarator. */
+ if (TREE_CODE (x) == PARM_DECL && DECL_CONTEXT (x) == NULL_TREE)
+ /* Ignore. */;
+
/* Warn if shadowing an argument at the top level of the body. */
- if (oldlocal != NULL_TREE && !DECL_EXTERNAL (x)
- /* Inline decls shadow nothing. */
- && !DECL_FROM_INLINE (x)
- && TREE_CODE (oldlocal) == PARM_DECL
- /* Don't check the `this' parameter. */
- && !DECL_ARTIFICIAL (oldlocal))
+ else if (oldlocal != NULL_TREE && !DECL_EXTERNAL (x)
+ /* Inline decls shadow nothing. */
+ && !DECL_FROM_INLINE (x)
+ && TREE_CODE (oldlocal) == PARM_DECL
+ /* Don't check the `this' parameter. */
+ && !DECL_ARTIFICIAL (oldlocal))
{
bool err = false;
@@ -1038,10 +1043,7 @@ pushdecl_maybe_friend (tree x, bool is_friend)
}
}
- if (warn_shadow && !err
- /* Don't complain about the parms we push and then pop
- while tentatively parsing a function declarator. */
- && !(TREE_CODE (x) == PARM_DECL && DECL_CONTEXT (x) == NULL_TREE))
+ if (warn_shadow && !err)
{
warning (OPT_Wshadow, "declaration of %q#D shadows a parameter", x);
warning (OPT_Wshadow, "%Jshadowed declaration is here", oldlocal);