1 // { dg-do run } 2 // GROUPS passed 3 extern "C" int printf (const char *, ...); 4 extern "C" void exit(int); 5 6 class A { 7 public: ~A()8 virtual ~A() { 9 printf("FAIL\n"); 10 exit (1); 11 } 12 }; 13 14 class B : public A { 15 public: ~B()16 virtual ~B() { 17 printf("PASS\n"); 18 exit (0); 19 } 20 }; 21 main()22int main() { 23 B b; 24 A *ap = &b; 25 ap->~A(); // This should call the destructor virtually. 26 printf("FAIL\n"); 27 return 1; 28 } 29