OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [inherit/] [thunk7.C] - Blame information for rev 774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// { dg-do run }
2
 
3
#include 
4
 
5
class A
6
{
7
    int a, b;
8
public:
9
    virtual void foo (int a, int b, int c, int d);
10
};
11
 
12
class B
13
{
14
    int c, d;
15
public:
16
    virtual void bar (int a, int b, int c, int d);
17
};
18
 
19
class D : public virtual A, public virtual B
20
{
21
    int e, f;
22
};
23
 
24
void A::foo(int a, int b, int c, int d)
25
{
26
    if (a != 1 || b != 2 || c != 3 || d != 4)
27
        abort ();
28
}
29
 
30
void B::bar (int a, int b, int c, int d)
31
{
32
    if (a != 5 || b != 6 || c != 7 || d != 8)
33
        abort ();
34
}
35
 
36
class C: private D, public virtual A, public virtual B
37
{
38
public:
39
    virtual void foo (int a, int b, int c, int d) { A::foo (a, b, c, d); D::A::foo (a, b, c, d); }
40
    virtual void bar (int a, int b, int c, int d) { B::bar (a, b, c, d); D::B::bar (a, b, c, d); }
41
};
42
 
43
C c1;
44
C *c2 = &c1;
45
A *c3 = &c1;
46
B *c4 = &c1;
47
 
48
int main()
49
{
50
    c2->foo (1, 2, 3, 4);
51
    c2->bar (5, 6, 7, 8);
52
    c3->foo (1, 2, 3, 4);
53
    c4->bar (5, 6, 7, 8);
54
    return 0;
55
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.