aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.mike/p2960.C
blob: f7c88d9843c60981fa7947ea9d77ae9c29d2aed7 (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
29
30
// prms-id: 2960

extern "C" int printf(const char *, ...);

class Test0 {
public:
  virtual void f0() { }      // works fine if this virtual removed
};

class Test1 : public Test0 {
public:
  void f1() { f2(); }		// generates bus error here
  virtual void f2() { printf("Test1::f2\n"); }
};

class Test2 {
public:
  virtual void f3() { }
};

class Test3 : public Test2, public Test1 {    // works fine if Test1 first
public:
  virtual ~Test3() { f1(); }                       // calling f2 directly works
  virtual void f2() { printf("Test3::f2\n"); }
};

main() {
    Test3 t3;
    return 0;
}