https://gcc.gnu.org/bugzilla/show_bug.cgi?id=12341
Benjamin Priour <priour.be at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |priour.be at gmail dot com --- Comment #7 from Benjamin Priour <priour.be at gmail dot com> --- Hi, I'm currently fixing this, I've put it under -Wshadow for now, as it is still about shadowing names, but I could add a -Wname-hiding or something akin to it. What about the visibility of the base class field ? I think that in snippet (1) below, a warning should be issued, as we can imagine Base being virtual with private field x and a friend function foo(Base*) taking polymorphic argument Base*, then Derived inherits of Base, with public field x. There might be an ambiguity upon accessing x in a call to foo((Base *) derived). Therefore, I believe the warning should be issued no matter the visibility of the fields within the parent's class. However, if Grandpa class is privately inherited by Base class, then I'd expect Derived to not issue warnings for its fields named only after Grandpa's. // Snippet (1) class Base { private: int x; }; class Derived : public Base { public: int x; // issue warning despite Base::x private }; // Snippet (2) class Grandpa; class Base : private Grandpa; class Derived : public Base; // No warnings emitted for eponymous fields of Grandpa's