2004-01-23 David Carlton <carlton@kealia.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.cp / namespace.cc
CommitLineData
66a55e80
DB
1namespace AAA {
2 char c;
3 int i;
4 int A_xyzq (int);
5 char xyzq (char);
6 class inA {
7 public:
8 int xx;
9 int fum (int);
10 };
11};
12
13int AAA::inA::fum (int i)
14{
15 return 10 + i;
16}
17
18namespace BBB {
19 char c;
20 int i;
21 int B_xyzq (int);
22 char xyzq (char);
23
24 namespace CCC {
25 char xyzq (char);
26 };
27
28 class Class {
29 public:
30 char xyzq (char);
31 int dummy;
32 };
33};
34
35int AAA::A_xyzq (int x)
36{
37 return 2 * x;
38}
39
40char AAA::xyzq (char c)
41{
42 return 'a';
43}
44
45
46int BBB::B_xyzq (int x)
47{
48 return 3 * x;
49}
50
51char BBB::xyzq (char c)
52{
53 return 'b';
54}
55
56char BBB::CCC::xyzq (char c)
57{
58 return 'z';
59}
60
61char BBB::Class::xyzq (char c)
62{
63 return 'o';
64}
65
66void marker1(void)
67{
68 return;
69}
70
1fcb5155
DC
71namespace
72{
73 int X = 9;
74
75 namespace G
76 {
77 int Xg = 10;
79c2c32d
DC
78
79 namespace
80 {
81 int XgX = 11;
82 }
1fcb5155
DC
83 }
84}
85
86namespace C
87{
88 int c = 1;
89 int shadow = 12;
90
63d06c5c
DC
91 class CClass {
92 public:
93 int x;
94 class NestedClass {
95 public:
96 int y;
97 };
98 };
99
1fcb5155
DC
100 namespace
101 {
102 int cX = 6;
103
104 namespace F
105 {
106 int cXf = 7;
79c2c32d
DC
107
108 namespace
109 {
110 int cXfX = 8;
111 }
1fcb5155
DC
112 }
113 }
114
115 namespace C
116 {
117 int cc = 2;
118 }
119
79c2c32d
DC
120 namespace E
121 {
122 int ce = 4;
123 }
124
1fcb5155
DC
125 namespace D
126 {
127 int cd = 3;
128 int shadow = 13;
129
130 namespace E
131 {
132 int cde = 5;
133 }
134
135 void marker2 (void)
136 {
137 // NOTE: carlton/2003-04-23: I'm listing the expressions that I
138 // plan to have GDB try to print out, just to make sure that the
139 // compiler and I agree which ones should be legal! It's easy
140 // to screw up when testing the boundaries of namespace stuff.
141 c;
142 //cc;
143 C::cc;
144 cd;
79c2c32d 145 //C::D::cd;
1fcb5155
DC
146 E::cde;
147 shadow;
79c2c32d 148 //E::ce;
1fcb5155
DC
149 cX;
150 F::cXf;
79c2c32d 151 F::cXfX;
1fcb5155
DC
152 X;
153 G::Xg;
154 //cXOtherFile;
155 //XOtherFile;
79c2c32d 156 G::XgX;
1fcb5155
DC
157
158 return;
159 }
160
161 }
162}
66a55e80
DB
163
164int main ()
165{
166 using AAA::inA;
167 char c1;
168
169 using namespace BBB;
170
171 c1 = xyzq ('x');
172 c1 = AAA::xyzq ('x');
173 c1 = BBB::CCC::xyzq ('m');
174
175 inA ina;
176
177 ina.xx = 33;
178
179 int y;
180
181 y = AAA::A_xyzq (33);
182 y += B_xyzq (44);
183
184 BBB::Class cl;
185
186 c1 = cl.xyzq('e');
187
188 marker1();
189
1fcb5155 190 C::D::marker2 ();
66a55e80 191}
This page took 0.355469 seconds and 4 git commands to generate.