summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.mike/misc14.C
blob: 6f966f211ca97b7cf30611ea661a4819cb33f951 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// { dg-do run  }
// GROUPS passed
extern "C" int printf (const char *, ...);
extern "C" void exit(int);

class A {
public:
  virtual ~A() {
    printf("FAIL\n");
    exit (1);
  }
};

class B : public A {
public:
  virtual ~B() {
    printf("PASS\n");
    exit (0);
  }
};

int main() {
  B b;
  A *ap = &b;
  ap->~A();  // This should call the destructor virtually.
  printf("FAIL\n");
  return 1;
}