Automatic date update in version.in
[binutils-gdb/blckswan.git] / gdb / testsuite / gdb.cp / namespace.cc
blob8c78a7e9da641e6736f630df193ee603fff5daf3
1 namespace 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);
11 enum SomeEnum {
12 ALPHA,
13 BETA,
14 DELTA
18 int AAA::inA::fum (int i)
20 return 10 + i;
23 namespace BBB {
24 char c;
25 int i;
26 int B_xyzq (int);
27 char xyzq (char);
29 namespace CCC {
30 char xyzq (char);
33 class Class {
34 public:
35 char xyzq (char);
36 int dummy;
40 int AAA::A_xyzq (int x)
42 return 2 * x;
45 char AAA::xyzq (char c)
47 return 'a';
51 int BBB::B_xyzq (int x)
53 return 3 * x;
56 char BBB::xyzq (char c)
58 return 'b';
61 char BBB::CCC::xyzq (char c)
63 return 'z';
66 char BBB::Class::xyzq (char c)
68 return 'o';
71 void marker1(void)
73 return;
76 namespace
78 int X = 9;
80 namespace G
82 int Xg = 10;
84 namespace
86 int XgX = 11;
91 namespace C
93 int c = 1;
94 int shadow = 12;
96 class CClass {
97 public:
98 int x;
99 class NestedClass {
100 public:
101 int y;
105 void ensureRefs () {
106 // NOTE (2004-04-23, carlton): This function is here only to make
107 // sure that GCC 3.4 outputs debug info for these classes.
108 static CClass *c = new CClass();
109 static CClass::NestedClass *n = new CClass::NestedClass();
112 namespace
114 int cX = 6;
116 namespace F
118 int cXf = 7;
120 namespace
122 int cXfX = 8;
127 namespace C
129 int cc = 2;
132 namespace E
134 int ce = 4;
137 namespace D
139 int cd = 3;
140 int shadow = 13;
142 namespace E
144 int cde = 5;
147 void marker2 (void)
149 // NOTE: carlton/2003-04-23: I'm listing the expressions that I
150 // plan to have GDB try to print out, just to make sure that the
151 // compiler and I agree which ones should be legal! It's easy
152 // to screw up when testing the boundaries of namespace stuff.
153 (void) c;
154 //cc;
155 (void) C::cc;
156 (void) cd;
157 //C::D::cd;
158 (void) E::cde;
159 (void) shadow;
160 //E::ce;
161 (void) cX;
162 (void) F::cXf;
163 (void) F::cXfX;
164 (void) X;
165 (void) G::Xg;
166 //cXOtherFile;
167 //XOtherFile;
168 (void) G::XgX;
170 return;
176 extern int ensureOtherRefs ();
178 int main ()
180 using AAA::inA;
181 char c1;
182 AAA::SomeEnum var = AAA::ALPHA;
184 using namespace BBB;
186 c1 = xyzq ('x');
187 c1 = AAA::xyzq ('x');
188 c1 = BBB::CCC::xyzq ('m');
190 inA ina;
192 ina.xx = 33;
194 int y;
196 y = AAA::A_xyzq (33);
197 y += B_xyzq (44);
199 BBB::Class cl;
201 c1 = cl.xyzq('e');
203 marker1();
205 C::D::marker2 ();
207 C::ensureRefs ();
208 ensureOtherRefs ();