]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.c++/local.cc
Initial creation of sourceware repository
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.c++ / local.cc
1 // Tests for local types
2
3 void marker1 (void)
4 {
5 }
6
7
8 int foobar (int x)
9 {
10 class Local {
11 public:
12 int loc1;
13 char loc_foo (char c)
14 {
15 return c + 3;
16 }
17 };
18
19 Local l;
20 static Local l1;
21 char c;
22
23 l.loc1 = 23;
24
25 c = l.loc_foo('x');
26 return c + 2;
27 }
28
29 int main()
30 {
31 int c;
32
33 c = foobar (31);
34
35 { // inner block
36 class InnerLocal {
37 public:
38 char ilc;
39 int * ip;
40 int il_foo (unsigned const char & uccr)
41 {
42 return uccr + 333;
43 }
44 class NestedInnerLocal {
45 public:
46 int nil;
47 int nil_foo (int i)
48 {
49 return i * 27;
50 }
51 };
52 NestedInnerLocal nest1;
53 };
54
55 InnerLocal il;
56
57 il.ilc = 'b';
58 il.ip = &c;
59 }
60 marker1();
61 }
62
63
64
65
66
67