[Bug c++/31397] Useful compiler warning missing (virtual functions in derived classes used without 'virtual')

Thomas dot Lange at sun dot com gcc-bugzilla@gcc.gnu.org
Wed Jul 8 10:23:00 GMT 2009



------- Comment #3 from Thomas dot Lange at sun dot com  2009-07-08 10:23 -------
(In reply to comment #2)
> why don't you add a 'virtual'
> to your destructor and int f(int) functions, because they are implicitly
> virtual anyway'.

That is exactly the point this is about!
I want a way so the compiler enforces to add 'virtual' to ~B and B::f, and thus
help to write better understandable code.

This is in order for large derived trees or a big source code. It is for the
one looking at the declaration (and not anymore or not at all familiar with the
code!) to not miss that those functions are virtual.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31397



More information about the Gcc-bugs mailing list