Handle "p 'S::method()::static_var'" (quoted) in symbol lookup
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.cp / mb-ctor.cc
CommitLineData
ed0616c6
VP
1
2#include <stdio.h>
3
4class Base
5{
6public:
7 Base(int k);
8 ~Base();
9 virtual void foo() {}
10private:
11 int k;
12};
13
14Base::Base(int k)
15{
16 this->k = k;
17}
18
19Base::~Base()
20{
21 printf("~Base\n");
22}
23
24class Derived : public virtual Base
25{
26public:
27 Derived(int i);
28 ~Derived();
29private:
30 int i;
9ab4e744 31 int i2;
ed0616c6
VP
32};
33
34Derived::Derived(int i) : Base(i)
35{
36 this->i = i;
9ab4e744
DE
37 /* The next statement is spread over two lines on purpose to exercise
38 a bug where breakpoints set on all but the last line of a statement
39 would not get multiple breakpoints.
40 The second line's text for gdb_get_line_number is a subset of the
41 first line so that we don't care which line gdb prints when it stops. */
42 this->i2 = // set breakpoint here
43 i; // breakpoint here
ed0616c6
VP
44}
45
46Derived::~Derived()
47{
48 printf("~Derived\n");
49}
50
51class DeeplyDerived : public Derived
52{
53public:
54 DeeplyDerived(int i) : Base(i), Derived(i) {}
55};
56
57int main()
58{
59 /* Invokes the Derived ctor that constructs both
60 Derived and Base. */
61 Derived d(7);
62 /* Invokes the Derived ctor that constructs only
63 Derived. Base is constructed separately by
64 DeeplyDerived's ctor. */
65 DeeplyDerived dd(15);
66}
This page took 1.129108 seconds and 4 git commands to generate.