1 // PR c++/52746 2 // { dg-do run } 3 4 extern "C" int printf(const char*,...); 5 extern "C" void abort(); 6 bool db; 7 8 struct A 9 { ~AA10 virtual ~A() {} 11 }; 12 13 struct B : public A 14 { ~BB15 virtual ~B() { db = true; } 16 }; 17 test()18template<int> void test() 19 { 20 B * b = new B; 21 A * a = b; 22 a->~A(); 23 ::operator delete(b); 24 } 25 main()26int main() 27 { 28 test<0>(); 29 if (!db) 30 abort(); 31 } 32