http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58140
Andrew Gallagher <andrewjcg at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |andrewjcg at gmail dot com
--- Comment #4 from Andrew Gallagher <andrewjcg at gmail dot com> ---
FWIW, I suppose one case where "-Wnon-virtual-dtor" is more useful than
"-Wdelete-non-virtual-dtor" is when the actual delete occurs in system
headers/libs. This seems to be case when using std::unique_ptr, where the
actual "-Wdelete-non-virtual-dtor" warning is muted unless "-Wsystem-headers"
is used, which might not be desirable:
#include <memory>
class A {
public:
virtual void a() {}
};
class B : public A {
public:
virtual void b() {}
};
int main(int argc, char ** argv) {
A *a = new B();
delete a; // triggers -Wdelete-non-virtual-dtor
std::unique_ptr<A> p(new B()); // doesn't
}