This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/56556] New: Wshadow warns for private members in base classes
- From: "david at doublewise dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 07 Mar 2013 00:44:24 +0000
- Subject: [Bug c++/56556] New: Wshadow warns for private members in base classes
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56556
Bug #: 56556
Summary: Wshadow warns for private members in base classes
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: david@doublewise.net
The following code warns due to -Wshadow:
class Base {
private:
int x;
};
class Derived : public Base {
Derived(int x) {}
};
Perhaps we should consider not having this warn? In my particular case, I have
a Base class with a private member variable, a class Derived that derives from
Base, and a class EvenMoreDerived that derives from Derived. In a member
function of EvenMoreDerived, I am trying to use a variable with the same name
as the private member variable of Base.
The only situation I can think of where this could theoretically be useful is
if there is some kind of overload resolution issue, but due to derived classes
hiding member functions of base classes I don't imagine that would be an issue.