gdb
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.cp / method.cc
CommitLineData
c906108c
SS
1// Class funk has a constructor and an ordinary method
2// Test for CHFts23426
3
4class funk
5{
6public:
7 funk();
8 void getFunky(int a, int b);
9 int data_;
10};
11
12funk::funk()
13 : data_(33)
14{
15}
16
17void funk::getFunky(int a, int b)
18{
19 int res;
20 res = a + b - data_;
21 data_ = res;
22}
23
24// Class A has const and volatile methods
25
26class A {
27public:
28 int x;
29 int y;
30 int foo (int arg);
31 int bar (int arg) const;
32 int baz (int arg, char c) volatile;
33 int qux (int arg, float f) const volatile;
34};
35
36int A::foo (int arg)
37{
38 x += arg;
39 return arg *2;
40}
41
42int A::bar (int arg) const
43{
44 return arg + 2 * x;
45}
46
47int A::baz (int arg, char c) volatile
48{
49 return arg - 2 * x + c;
50}
51
52int A::qux (int arg, float f) const volatile
53{
54 if (f > 0)
55 return 2 * arg - x;
56 else
57 return 2 * arg + x;
58}
59
60
61int main()
62{
63 A a;
64 int k;
65
66 k = 10;
67 a.x = k * 2;
68
69 k = a.foo(13);
70
71 k += a.bar(15);
72
73 // Test for CHFts23426 follows
74 funk f;
75 f.getFunky(1, 2);
76 return 0;
77}
78
79
80
This page took 0.876457 seconds and 4 git commands to generate.