In our projects it happens (rarely but it happens) that in a derived class a non-virtual method from the base-class is hidden by a method with the same prototype. In that case the compiler (in our case g++ 4.4) stays quiet. While I can see that no warning can be useful for private methods, for protected or public methods this should be at least a configurable warning.
If such a things exists I'm unable to find it.
Here's a small example I'd like to have g++ complain about (be assured that this kind of code-pattern is never written like this in one shot, usually work was at some point in time a virtual method in A and was inexplicably changed later):
class A
{
public:
void work(int p)
{ /* do something */ }
};
class B : public A
{
public:
void work(int p)
{ /* do something different */ }
};
Result: no warning even with -Wall -Wextra.
You're not overriding the method, you're hiding it. It's a C++ feature.
You can take a look at this link.
Also, an interesting extract: