Commit | Line | Data |
---|---|---|
edf3d5f3 TT |
1 | // This first batch of classes are for PR 11226. |
2 | namespace mc { | |
3 | class Base { | |
4 | protected: | |
5 | int x; | |
6 | ||
7 | public: | |
8 | Base(void) { x = 2; }; | |
9 | }; | |
10 | } | |
11 | ||
12 | namespace ph { | |
13 | class Middle: public virtual mc::Base { | |
14 | protected: | |
15 | int y; | |
16 | ||
17 | public: | |
18 | Middle(void): mc::Base() { y = 3; }; | |
19 | ||
20 | int get_y(void) | |
21 | { | |
22 | return y; // breakpoint 1 | |
23 | }; | |
24 | }; | |
25 | ||
26 | class Derived: public virtual Middle { | |
27 | protected: | |
28 | int z; | |
29 | ||
30 | public: | |
31 | Derived(void): Middle() { z = 4; }; | |
32 | ||
33 | int get_z(void) | |
34 | { | |
35 | return z; // breakpoint 2 | |
36 | }; | |
37 | }; | |
38 | } | |
39 | ||
40 | // These classes are for PR 9629. | |
41 | struct A {}; | |
42 | struct B : virtual A {}; | |
43 | ||
44 | struct C {int v; C() {v=11;};}; | |
45 | struct D:virtual C{}; | |
46 | ||
47 | class E:B,D{}; | |
48 | ||
9c3c02fd TT |
49 | // These classes are for another regression test, from |
50 | // https://bugzilla.redhat.com/show_bug.cgi?id=560741 | |
51 | ||
52 | class RHA | |
53 | { | |
54 | public: | |
55 | RHA() : mA(0xaaaaaaaa) {} | |
56 | virtual void a() = 0; | |
57 | int mA; | |
58 | }; | |
59 | ||
60 | class RHB | |
61 | { | |
62 | public: | |
63 | RHB() : mB(0xbbbbbbbb) {} | |
64 | virtual void b() = 0; | |
65 | int mB; | |
66 | }; | |
67 | ||
68 | class RHC : public RHA, | |
69 | public RHB | |
70 | { | |
71 | public: | |
72 | RHC() : RHA(), RHB() {} | |
73 | virtual void a() {} | |
74 | virtual void b() {} | |
75 | }; | |
76 | ||
9655fd1a JK |
77 | class RTTI_base |
78 | { | |
79 | public: | |
80 | virtual ~RTTI_base() {} | |
81 | }; | |
9c3c02fd | 82 | |
9655fd1a JK |
83 | class RTTI_data |
84 | { | |
85 | public: | |
86 | RTTI_base base; | |
87 | int data; | |
88 | RTTI_data() : data(1) {} | |
89 | }; | |
9c3c02fd | 90 | |
edf3d5f3 TT |
91 | int main() { |
92 | ph::Derived tst; | |
93 | tst.get_y(); | |
94 | tst.get_z(); | |
95 | ||
96 | E *e = new E; | |
9c3c02fd | 97 | RHB *b = new RHC(); |
9655fd1a | 98 | RTTI_data rtti_data; |
edf3d5f3 TT |
99 | |
100 | return 0; // breakpoint 3 | |
101 | } |