Quuxplusone added a comment. FWIW, I think the example you gave is **correct** for GCC to warn on. You said:
class Base { virtual void foo(); // to be overridden void foo(int); // implemented in terms of foo() }; foo(int) is hidden in derived classes. So if someone derives from Base (which someone must, because Base is polymorphic), then the derived class violates the Liskov substitution principle: it doesn't have an `obj.foo(42)` method. The correct solution is to rename the implementation method from `foo()` to e.g. `fooImpl()` or (my personal style, following the NVI idiom) `do_foo()`. GCC is correct to warn that this code is confusing and hard to maintain because of name hiding. The solution is to adjust the code until it is clear and maintainable, at which point it'll no longer trigger the warning. I don't see any problem with GCC's warning here. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D82617/new/ https://reviews.llvm.org/D82617 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits