xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.cp/operator.cc (revision a5a4af3bd380a7b58b758d9b311cef9f7c34aeb4)
1 class A
2 {
3 };
4 
operator ==(A,int)5 int operator== (A, int)
6 {
7   return 11;
8 }
9 
operator ==(A,char)10 int operator== (A, char)
11 {
12   return 12;
13 }
14 
15 //------------------
16 
17 namespace B
18 {
19   class C
20   {
21   };
22 
operator ==(C,int)23   int operator== (C, int)
24   {
25     return 22;
26   }
27 
operator ==(C,char)28   int operator== (C, char)
29   {
30     return 23;
31   }
32 
33   namespace BD
34   {
operator ==(C,int)35     int operator== (C, int)
36     {
37       return 24;
38     }
39   }
40 }
41 
42 //------------------
43 
44 class D
45 {
46 };
47 namespace
48 {
operator ==(D,int)49   int operator== (D, int)
50   {
51     return 33;
52   }
53 
operator ==(D,char)54   int operator== (D, char)
55   {
56     return 34;
57   }
58 }
59 
operator ==(D,float)60 int operator== (D, float)
61 {
62   return 35;
63 }
64 
65 //------------------
66 
67 class E
68 {
69 };
70 namespace F
71 {
operator ==(E,int)72   int operator== (E, int)
73   {
74     return 44;
75   }
76 
operator ==(E,char)77   int operator== (E, char)
78   {
79     return 45;
80   }
81 }
82 
operator ==(E,float)83 int operator== (E, float)
84 {
85   return 46;
86 }
87 
88 using namespace F;
89 
90 //-----------------
91 
92 class G
93 {
94 public:
operator ==(int)95   int operator== (int)
96   {
97     return 55;
98   }
99 };
100 
operator ==(G,char)101 int operator== (G, char)
102 {
103   return 56;
104 }
105 
106 //------------------
107 
108 class H
109 {
110 };
111 namespace I
112 {
operator ==(H,int)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;
operator ==(J,int)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 {
operator ==(L,int)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 
main()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