aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.cp/virtbase.cc
blob: ae0a2c719ab5a45fb9301aedb9bb1dae3d213cbe (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
// 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{};

int main() {
  ph::Derived tst;
  tst.get_y();
  tst.get_z();

  E *e = new E;

  return 0;			// breakpoint 3
}