[Bug c++/31397] Useful compiler warning missing (virtual functions in derived classes used without 'virtual')
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jun 21 16:13:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31397
--- Comment #13 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-06-21 16:12:42 UTC ---
G++ 4.7 implements C++0x explicit override control so you can add 'override'
class B : public A
{
B( int y );
~B();
int f( int x ) override;
};
and you'll get an error if it doesn't actually override a virtual function from
a base class.
It's not *quite* what you want, but you could use it to check whether B::f
overrides a virtual (and so you want to add 'virtual' to it) without checking
the declaration of A::f
More information about the Gcc-bugs
mailing list