https://gcc.gnu.org/bugzilla/show_bug.cgi?id=22395
--- Comment #6 from Eric Gallager <egallager at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #5) > private inheritance doesn't mean the destructor can't be called with the > wrong static type > > class Foo { > public: > ~Foo() {} > virtual void f() { } > }; > > class Bar : private Foo { > public: > Foo* get() { return this; } > }; > > int main() > { > Bar* b = new Bar; > delete b->get(); > } > > as stated in PR 16166 comment 3, the 3rd edition of Effective C++ changes > the guideline, and -Wdelete-non-virtual-dtor is usually a better option > anyway Note that clang goes even farther in splitting up -Wdelete-non-virtual-dtor into different warnings based on whether the dtor is abstract or not: https://clang.llvm.org/docs/DiagnosticsReference.html#wdelete-abstract-non-virtual-dtor Maybe gcc should do likewise?