blob: e23dbda813a56acbbf487b952a9f4528a1a41e0c (
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
// This first batch of classes are for PR 11226.
namespace mc {
class Base {
protected:
int x;
public:
Base(void) { x = 2; };
};
}
namespace ph {
class Middle: public virtual mc::Base {
protected:
int y;
public:
Middle(void): mc::Base() { y = 3; };
int get_y(void)
{
return y; // breakpoint 1
};
};
class Derived: public virtual Middle {
protected:
int z;
public:
Derived(void): Middle() { z = 4; };
int get_z(void)
{
return z; // breakpoint 2
};
};
}
// These classes are for PR 9629.
struct A {};
struct B : virtual A {};
struct C {int v; C() {v=11;};};
struct D:virtual C{};
class E:B,D{};
// These classes are for another regression test, from
// https://bugzilla.redhat.com/show_bug.cgi?id=560741
class RHA
{
public:
RHA() : mA(0xaaaaaaaa) {}
virtual void a() = 0;
int mA;
};
class RHB
{
public:
RHB() : mB(0xbbbbbbbb) {}
virtual void b() = 0;
int mB;
};
class RHC : public RHA,
public RHB
{
public:
RHC() : RHA(), RHB() {}
virtual void a() {}
virtual void b() {}
};
class RTTI_base
{
public:
virtual ~RTTI_base() {}
};
class RTTI_data
{
public:
RTTI_base base;
int data;
RTTI_data() : data(1) {}
};
/* These classes are for testing pointer adjustment when printing a
pointer into a virtual base, with print object on. */
struct VirtualBase {
int x;
virtual ~VirtualBase() {}
};
struct VirtualMiddleA : public virtual VirtualBase {
/* Make sure the vbase offset of Virtual::VirtualBaseB is larger
than what fits in one byte. */
int y[300];
virtual ~VirtualMiddleA() {}
};
struct VirtualMiddleB : public virtual VirtualBase {
int y;
virtual ~VirtualMiddleB() {}
};
struct Virtual : public virtual VirtualMiddleA, public virtual VirtualMiddleB {
int z;
virtual ~Virtual() {}
};
Virtual virtual_o;
VirtualMiddleB *virtual_middle_b = &virtual_o;
int main() {
ph::Derived tst;
tst.get_y();
tst.get_z();
E *e = new E;
RHB *b = new RHC();
RTTI_data rtti_data;
return 0; // breakpoint 3
}
|