This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/56100] spurious -Wshadow warning with local variable in template class
- From: "paolo.carlini at oracle dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 31 Mar 2015 12:14:50 +0000
- Subject: [Bug c++/56100] spurious -Wshadow warning with local variable in template class
- Auto-submitted: auto-generated
- References: <bug-56100-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56100
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org,
| |paolo.carlini at oracle dot com
--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
I wonder if in such cases would it simply make sense to suppress the warning
basing on the locations, eg the below certainly works for the testcase and
passes testing:
Index: name-lookup.c
===================================================================
--- name-lookup.c (revision 221789)
+++ name-lookup.c (working copy)
@@ -1271,7 +1271,9 @@ pushdecl_maybe_friend_1 (tree x, bool is_friend)
}
}
else if (oldglobal != NULL_TREE
- && (VAR_P (oldglobal)
+ && ((VAR_P (oldglobal)
+ && (input_location
+ > DECL_SOURCE_LOCATION (oldglobal)))
/* If the old decl is a type decl, only warn if the
old decl is an explicit typedef or if both the
old and new decls are type decls. */