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