OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.cp/] [mb-ctor.cc] - Blame information for rev 231

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
 
2
#include <stdio.h>
3
 
4
class Base
5
{
6
public:
7
  Base(int k);
8
  ~Base();
9
  virtual void foo() {}
10
private:
11
  int k;
12
};
13
 
14
Base::Base(int k)
15
{
16
  this->k = k;
17
}
18
 
19
Base::~Base()
20
{
21
    printf("~Base\n");
22
}
23
 
24
class Derived : public virtual Base
25
{
26
public:
27
  Derived(int i);
28
  ~Derived();
29
private:
30
  int i;
31
  int i2;
32
};
33
 
34
Derived::Derived(int i) : Base(i)
35
{
36
  this->i = i;
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
44
}
45
 
46
Derived::~Derived()
47
{
48
    printf("~Derived\n");
49
}
50
 
51
class DeeplyDerived : public Derived
52
{
53
public:
54
  DeeplyDerived(int i) : Base(i), Derived(i) {}
55
};
56
 
57
int 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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.