------- Comment #4 from spark at gcc dot gnu dot org 2008-01-24 18:16 ------- I don't think this can be implemented in the FE, at least to be really effective. The more common cases are not really "empty" destructor. E.g. there's inlining involved:
class Foo { public: virtual ~Foo(); }; Foo::~Foo() { } class Bar : public Foo { public: virtual ~Bar(); }; Bar::~Bar() { } where Foo::~Foo() has to be inlined before we can determine ~Bar() is really empty. But "emptiness" isn't really how we want to decide eliminating those but rather the dependence on the vtable itself. e.g.: extern "C" int printf(const char* s); class Foo { public: virtual ~Foo(); }; Foo::~Foo() { printf("good bye foo\n"); } class Bar : public Foo { public: virtual ~Bar(); }; Bar::~Bar() { printf("good bye bar\n"); } In this case, there's no need for vtable update inside the destructor (which is more common). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34949