This bug is related to the example in [class.dtor]/12 of standard N2960. according to the example, in the following program:
#include <iostream> struct B { virtual ~B() { std::cout << "~B" << std::endl; } }; struct D : B { ~D () { std::cout << "~D" << std::endl; } }; typedef B B_alias; int main() { D D_object; B* B_ptr = &D_object; std::cout << "begin" << std::endl; D_object.B::~B(); B_ptr->~B(); std::cout << "end" << std::endl; return 0; } D_object .B::~B () should call B¡¯s destructor, and B_ptr ->~B () should call D's destructor. However the actual result is begin ~B ~B end ... the strange thing is when D_object.B::~B() be removed, or be swapped between B_ptr->~B(), everything is OK. Another problem: according to the spec, 'Once a destructor is invoked for an object, the object no longer exists'. However, the following code shows that g++ doesn't respect it: #include <iostream> struct C { ~C() { std::cout << "XXX" << std::endl; } }; int main() { C * c = new C(); c->C::~C(); delete c; return 0; } the program ends normally. Shouldn't it generate a double free fault? -- Summary: g++ violate [class.dtor] when explicit destructor call Product: gcc Version: 4.3.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pi3orama at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42063