summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.mike/p4623.C
blob: f602c9fdf1cd64d81f696cb241062969011c809a (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
31
32
33
34
35
36
// { dg-do run  }
// prms-id: 4623

class base {
public:
  int b_data;
  base( int i=0 ) { b_data = i; }
  void b_print() { }
};

class base1: virtual public base {
public:
  int b1_data;
  base1( int i = 0 ) { b1_data = i; b_data++; }
  void b1_print() { }
};

class base2: virtual public base {
public:
  int b2_data;
  base2( int i = 0 ) { b2_data = i; b_data++; }
  void b2_print() { }
};

class base3: public base {};

class derived: public base3, public base1, public base2 {
public:
  int d_data;
  derived( int i ) { d_data = i; ((base3 *)this)->b_data++; }
  void d_print() { }
};

int main() {
  derived d(1); d.d_print(); return 0;
}