C++11 added override
to ensure that member functions you write that you intend to override base-class virtual functions actually do (or won\'t compile).
The problem I see with -Werror=suggest-override
is that it does not allow you to write the following:
void f() final {...}
Even though there is an implicit override
here. The -Werror=suggest-override
does not ignore this (like it should, since the override
is redundant in this case)
But it is more complicated than that... If you write
virtual void f() final {...}
It means a completely different thing than
virtual void f() override final {...}
The first case does not need to override anything! The second does.
So I am assuming the GCC check is implemented this way (i.e. to sometimes accept the redundant override
) in order to get the last case right. But this does not play well e.g. with clang-tidy, which will correctly remove the override when final is sufficient (but then GCC compilation will fail...)