Anyone know of a tool that can find non-virtual destructors of polymorphic base classes?
+6
A:
Compiling with g++ -Wall
will give a warning about that. Or -Wnon-virtual-dtor
if you just want that warning.
Mike Seymour
2010-10-11 13:48:01
+1, you beat me to it
stijn
2010-10-11 13:50:15
A:
gcc -Wall
will print messages like
class x has virtual functions but non-virtual destructor
stijn
2010-10-11 13:49:43
A:
It looks like cpplint from google will check this and other C++ style things. If you just want to check virtual destructors cpplint --filter=-,+runtime/virtual
will limit the reported problems to just those.
Geoff Reedy
2010-10-11 13:55:23