[Bug c++/57709] -Wshadow is too strict / has false positives
manu at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jun 25 16:46:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57709
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org,
| |manu at gcc dot gnu.org
--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> > clang does no warn on "var_and_method" as variable vs. method are safe, if one
> > tries to use them inappropriately one gets an error.
>
> Not always. Think of function pointers or pointer to member functions.
> clang is not loose in my mind rather than GCC is too strict.
In GCC 4.8 I implemented:
"The option -Wshadow no longer warns if a declaration shadows a function
declaration, unless the former declares a function or pointer to function,
because this is a common and valid case in real-world code."
I think this is a useful heuristic also for member functions, no? I don't have
time to work on this at the moment, but it would be useful to know whether the
maintainers agree, so someone (Jan?) may start working on a patch.
More information about the Gcc-bugs
mailing list