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);
10   };
11   enum SomeEnum {
12     ALPHA,
13     BETA,
14     DELTA
15   };
16 };
17 
fum(int i)18 int AAA::inA::fum (int i)
19 {
20   return 10 + i;
21 }
22 
23 namespace BBB {
24   char c;
25   int i;
26   int B_xyzq (int);
27   char xyzq (char);
28 
29   namespace CCC {
30     char xyzq (char);
31   };
32 
33   class Class {
34   public:
35     char xyzq (char);
36     int dummy;
37   };
38 };
39 
A_xyzq(int x)40 int AAA::A_xyzq (int x)
41 {
42   return 2 * x;
43 }
44 
xyzq(char c)45 char AAA::xyzq (char c)
46 {
47   return 'a';
48 }
49 
50 
B_xyzq(int x)51 int BBB::B_xyzq (int x)
52 {
53   return 3 * x;
54 }
55 
xyzq(char c)56 char BBB::xyzq (char c)
57 {
58   return 'b';
59 }
60 
xyzq(char c)61 char BBB::CCC::xyzq (char c)
62 {
63   return 'z';
64 }
65 
xyzq(char c)66 char BBB::Class::xyzq (char c)
67 {
68   return 'o';
69 }
70 
marker1(void)71 void marker1(void)
72 {
73   return;
74 }
75 
76 namespace
77 {
78   int X = 9;
79 
80   namespace G
81   {
82     int Xg = 10;
83 
84     namespace
85     {
86       int XgX = 11;
87     }
88   }
89 }
90 
91 namespace C
92 {
93   int c = 1;
94   int shadow = 12;
95 
96   class CClass {
97   public:
98     int x;
99     class NestedClass {
100     public:
101       int y;
102     };
103   };
104 
ensureRefs()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();
110   }
111 
112   namespace
113   {
114     int cX = 6;
115 
116     namespace F
117     {
118       int cXf = 7;
119 
120       namespace
121       {
122 	int cXfX = 8;
123       }
124     }
125   }
126 
127   namespace C
128   {
129     int cc = 2;
130   }
131 
132   namespace E
133   {
134     int ce = 4;
135   }
136 
137   namespace D
138   {
139     int cd = 3;
140     int shadow = 13;
141 
142     namespace E
143     {
144       int cde = 5;
145     }
146 
marker2(void)147     void marker2 (void)
148     {
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;
169 
170       return;
171     }
172 
173   }
174 }
175 
176 extern int ensureOtherRefs ();
177 
main()178 int main ()
179 {
180   using AAA::inA;
181   char c1;
182   AAA::SomeEnum var = AAA::ALPHA;
183 
184   using namespace BBB;
185 
186   c1 = xyzq ('x');
187   c1 = AAA::xyzq ('x');
188   c1 = BBB::CCC::xyzq ('m');
189 
190   inA ina;
191 
192   ina.xx = 33;
193 
194   int y;
195 
196   y = AAA::A_xyzq (33);
197   y += B_xyzq (44);
198 
199   BBB::Class cl;
200 
201   c1 = cl.xyzq('e');
202 
203   marker1();
204 
205   C::D::marker2 ();
206 
207   C::ensureRefs ();
208   ensureOtherRefs ();
209 }
210