This is the mail archive of the gcc-bugs@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]

[Bug c++/56556] Wshadow warns for private members in base classes


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56556

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |egallager at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #2 from Eric Gallager <egallager at gcc dot gnu.org> ---
Warning goes away if you use -Wshadow-local instead of just -Wshadow:

$ /usr/local/bin/g++ -c -Wall -Wextra -pedantic -Wshadow 56556.cc
56556.cc: In constructor ‘Derived::Derived(int)’:
56556.cc:7:17: warning: declaration of ‘x’ shadows a member of ‘Derived’
[-Wshadow]
  Derived(int x) {}
                 ^
56556.cc:3:6: note: shadowed declaration is here
  int x;
      ^
56556.cc:7:14: warning: unused parameter ‘x’ [-Wunused-parameter]
  Derived(int x) {}
              ^
$ /usr/local/bin/g++ -c -Wall -Wextra -pedantic -Wshadow-local 56556.cc
56556.cc: In constructor ‘Derived::Derived(int)’:
56556.cc:7:14: warning: unused parameter ‘x’ [-Wunused-parameter]
  Derived(int x) {}
              ^
$

(same thing with -Wshadow-compatible-local instead of -Wshadow-local)

Since this warning is easily avoided, and I'd probably want to get the warning
anyways, I'm going to close this as INVALID.

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