summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/virtual9.C
blob: c10eef69f93b36e8dc4412d4443d297cf3b1f9d7 (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
37
38
39
40
41
42
43
44
45
46
// { dg-do run  }
// Source: Neil Booth, from PR #111.

class A
{
public :
     int i;
};

class B : virtual public A
{
};

class C : virtual public A
{
};

class D : public B, public C
{
public :
     int f(void);
     int g(void);
};

int D::f(void)
{
     return B::i;
}

int D::g(void)
{
     return this->B::i;
}

D d;
extern "C" void abort (void);

int main(void)
{
    d.C::i=325;

    if (d.f() != d.B::i || d.f() != d.g())
      abort ();

    return 0;
}