This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH c++/57709] Wshadow is too strict / has false positives


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."

This patch applies the same heuristic to member functions.

Bootstrapped and regression tested on x86_64-linux-gnu.

OK?

gcc/cp/ChangeLog:

2014-08-21  Manuel López-Ibáñez  <manu@gcc.gnu.org>

    PR c++/57709
    * name-lookup.c (pushdecl_maybe_friend_1): Do not warn 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.


gcc/testsuite/ChangeLog:

2014-08-21  Manuel López-Ibáñez  <manu@gcc.gnu.org>

    PR c++/57709
    * g++.dg/Wshadow.C: New test.

Attachment: pr57709.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]