This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/56556] Wshadow warns for private members in base classes
- From: "egallager at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 23 Aug 2017 13:35:48 +0000
- Subject: [Bug c++/56556] Wshadow warns for private members in base classes
- Auto-submitted: auto-generated
- References: <bug-56556-4@http.gcc.gnu.org/bugzilla/>
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.