xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.cp/operator.cc (revision cef8759bd76c1b621f8eab8faa6f208faabc2e15)
1 class A
2 {
3 };
4 
5 int operator== (A, int)
6 {
7   return 11;
8 }
9 
10 int operator== (A, char)
11 {
12   return 12;
13 }
14 
15 //------------------
16 
17 namespace B
18 {
19   class C
20   {
21   };
22 
23   int operator== (C, int)
24   {
25     return 22;
26   }
27 
28   int operator== (C, char)
29   {
30     return 23;
31   }
32 
33   namespace BD
34   {
35     int operator== (C, int)
36     {
37       return 24;
38     }
39   }
40 }
41 
42 //------------------
43 
44 class D
45 {
46 };
47 namespace
48 {
49   int operator== (D, int)
50   {
51     return 33;
52   }
53 
54   int operator== (D, char)
55   {
56     return 34;
57   }
58 }
59 
60 int operator== (D, float)
61 {
62   return 35;
63 }
64 
65 //------------------
66 
67 class E
68 {
69 };
70 namespace F
71 {
72   int operator== (E, int)
73   {
74     return 44;
75   }
76 
77   int operator== (E, char)
78   {
79     return 45;
80   }
81 }
82 
83 int operator== (E, float)
84 {
85   return 46;
86 }
87 
88 using namespace F;
89 
90 //-----------------
91 
92 class G
93 {
94 public:
95   int operator== (int)
96   {
97     return 55;
98   }
99 };
100 
101 int operator== (G, char)
102 {
103   return 56;
104 }
105 
106 //------------------
107 
108 class H
109 {
110 };
111 namespace I
112 {
113   int operator== (H, int)
114   {
115     return 66;
116   }
117 }
118 
119 namespace ALIAS = I;
120 
121 //------------------
122 
123 class J
124 {
125 };
126 
127 namespace K
128 {
129   int i;
130   int operator== (J, int)
131   {
132     return 77;
133   }
134 }
135 
136 using K::i;
137 
138 //------------------
139 
140 class L
141 {
142 };
143 namespace M
144 {
145   int operator== (L, int)
146   {
147     return 88;
148   }
149 }
150 
151 namespace N
152 {
153   using namespace M;
154 }
155 
156 using namespace N;
157 
158 //------------------
159 
160 namespace O
161 {
162   namespace P
163     {
164       using namespace ::O;
165     }
166   using namespace P;
167 }
168 
169 using namespace O;
170 
171 class test { };
172 test x;
173 
174 //------------------
175 
176 int main ()
177 {
178   A a;
179   a == 1;
180   a == 'a';
181 
182   B::C bc;
183   bc == 1;
184   bc == 'a';
185   B::BD::operator== (bc,'a');
186 
187   D d;
188   d == 1;
189   d == 'a';
190   d == 1.0f;
191 
192   E e;
193   e == 1;
194   e == 'a';
195   e == 1.0f;
196 
197   G g;
198   g == 1;
199   g == 'a';
200 
201   H h;
202   I::operator== (h, 1);
203 
204   J j;
205   K::operator== (j, 1);
206 
207   L l;
208   l == 1;
209 
210   return 0;
211 }
212