tags:

views:

60

answers:

3

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
+1, you beat me to it
stijn
A: 
gcc -Wall

will print messages like

class x has virtual functions but non-virtual destructor
stijn
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