ignore invalid DOF provider sections
[binutils-gdb.git] / gdb / testsuite / gdb.cp / virtbase.cc
blobe23dbda813a56acbbf487b952a9f4528a1a41e0c
1 // This first batch of classes are for PR 11226.
2 namespace mc {
3 class Base {
4 protected:
5 int x;
7 public:
8 Base(void) { x = 2; };
9 };
12 namespace ph {
13 class Middle: public virtual mc::Base {
14 protected:
15 int y;
17 public:
18 Middle(void): mc::Base() { y = 3; };
20 int get_y(void)
22 return y; // breakpoint 1
26 class Derived: public virtual Middle {
27 protected:
28 int z;
30 public:
31 Derived(void): Middle() { z = 4; };
33 int get_z(void)
35 return z; // breakpoint 2
40 // These classes are for PR 9629.
41 struct A {};
42 struct B : virtual A {};
44 struct C {int v; C() {v=11;};};
45 struct D:virtual C{};
47 class E:B,D{};
49 // These classes are for another regression test, from
50 // https://bugzilla.redhat.com/show_bug.cgi?id=560741
52 class RHA
54 public:
55 RHA() : mA(0xaaaaaaaa) {}
56 virtual void a() = 0;
57 int mA;
60 class RHB
62 public:
63 RHB() : mB(0xbbbbbbbb) {}
64 virtual void b() = 0;
65 int mB;
68 class RHC : public RHA,
69 public RHB
71 public:
72 RHC() : RHA(), RHB() {}
73 virtual void a() {}
74 virtual void b() {}
77 class RTTI_base
79 public:
80 virtual ~RTTI_base() {}
83 class RTTI_data
85 public:
86 RTTI_base base;
87 int data;
88 RTTI_data() : data(1) {}
91 /* These classes are for testing pointer adjustment when printing a
92 pointer into a virtual base, with print object on. */
93 struct VirtualBase {
94 int x;
96 virtual ~VirtualBase() {}
99 struct VirtualMiddleA : public virtual VirtualBase {
100 /* Make sure the vbase offset of Virtual::VirtualBaseB is larger
101 than what fits in one byte. */
102 int y[300];
104 virtual ~VirtualMiddleA() {}
107 struct VirtualMiddleB : public virtual VirtualBase {
108 int y;
110 virtual ~VirtualMiddleB() {}
113 struct Virtual : public virtual VirtualMiddleA, public virtual VirtualMiddleB {
114 int z;
116 virtual ~Virtual() {}
119 Virtual virtual_o;
120 VirtualMiddleB *virtual_middle_b = &virtual_o;
122 int main() {
123 ph::Derived tst;
124 tst.get_y();
125 tst.get_z();
127 E *e = new E;
128 RHB *b = new RHC();
129 RTTI_data rtti_data;
131 return 0; // breakpoint 3