diff options
Diffstat (limited to 'gdb/testsuite/gdb.cp/virtbase.cc')
-rw-r--r-- | gdb/testsuite/gdb.cp/virtbase.cc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.cp/virtbase.cc b/gdb/testsuite/gdb.cp/virtbase.cc index 1e6874f..e23dbda 100644 --- a/gdb/testsuite/gdb.cp/virtbase.cc +++ b/gdb/testsuite/gdb.cp/virtbase.cc @@ -88,6 +88,37 @@ public: 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(); |