The C++11 FDIS it says
If a virtual function is marked with the virt-specifier override and does not override a member function of a base class, the
If B:f
was non-virtual, then both D:f
functions would be ill-formed.
Yes, the program is ill formed when override
is added to any non-virtual function.
Generally, functions with differing signatures (overloaded), are as different as functions with different names. The example given in the Spec is not meant to imply that the function name effects override
. It's meant to show the common error that override
is designed to prevent.
What if
B::f
would not have been marked virtual? Is the program ill-formed, then?
Yes, it is. Because in order to override something, that something has to be virtual. Otherwise it's not overriding, it's hiding. So, the positive answer follows from the quote in your question.