Handle void * conversions in FreeBSD/x86 native code to fix C++ build.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.cp / koenig.cc
CommitLineData
7322dca9
SW
1namespace A
2{
3 class C
4 {
5 public:
6 static const int x = 11;
7 };
8
9 int
10 first (C c)
11 {
12 return 11;
13 }
14
15 int
16 first (int a, C c)
17 {
18 return 22;
19 }
20
21 int
22 second (int a, int b, C cc, int c, int d)
23 {
24 return 33;
25 }
26
36b11add
JK
27 int
28 entry (C c)
29 {
30 return 44;
31 }
7322dca9
SW
32}
33
34struct B
35{
36 A::C c;
37};
38
39//------------
40
41namespace E
42{
43 class O{};
44 int foo (O o){return 1; }
45 int foo (O o, O o2){return 2; }
46 int foo (O o, O o2, int i){return 3; }
47}
48
49namespace F
50{
51 class O{};
52 int foo ( O fo, ::E::O eo){ return 4;}
53 int foo (int i, O fo, ::E::O eo){ return 5;}
54}
55
56namespace G
57{
58 class O{};
59 int foo (O go, ::F::O fo, ::E::O eo){ return 6; }
60}
61
62//------------
63
64namespace H
65{
66 class O{};
67 int foo (O){ return 7;}
68}
69
70namespace I
71{
72 class O: public H::O {};
73 class X: H::O{};
74}
75
76//------------
77
78namespace J
79{
80 union U{};
81 struct S{};
82 enum E{};
83
84 class A{
85 public:
86 class B{};
87 };
88
89 class C{};
90
91 int foo (U){ return 8;}
92 int foo (S){ return 9;}
93 int foo (E){ return 10;}
94 int foo (A::B){ return 11;}
95 int foo (A*){ return 12;}
96 int foo (A**){ return 13;}
97 int foo (C[]){ return 14;}
98
99}
100//------------
101
102namespace K{
103 class O{};
104
105 int foo(O, int){
106 return 15;
107 }
108
109 int bar(O, int){
110 return 15;
111 }
112}
113
114int foo(K::O, float){
115 return 16;
116}
117
118int bar(K::O, int){
119 return 16;
120}
121//------------
122
123namespace L {
124 namespace A{
125 namespace B{
126 class O {};
127
128 int foo (O){
129 return 17;
130 }
131
132 }
133 }
134}
135
136//------------
137
138namespace M {
139 class A{
140 public:
141 int foo(char) {
142 return 18;
143 }
144 };
145
146 int foo(A,char){
147 return 19;
148 }
149
150 int foo(A *,char){
151 return 23;
152 }
153
154 int bar(char){
155 return 21;
156 }
157
158 namespace N {
159 int foo(::M::A,int){
160 return 20;
161 }
162
163 int bar(int){
164 return 22;
165 }
166 }
167}
168//------------
169
170namespace O {
171 class A{};
172
173 int foo(A,int){
174 return 23;
175 }
176
177}
178
179typedef O::A TOA;
180typedef TOA TTOA;
181
182//------------
4c3376c8 183
7d3fe98e
SW
184static union {
185 int a;
186 char b;
187}p_union;
188
189//------------
190
4c3376c8
SW
191namespace P {
192 class Q{
193 public:
194 int operator== (int)
195 {
196 return 24;
197 }
198
199 int operator== (float)
200 {
201 return 25;
202 }
203
204 int operator+ (float)
205 {
206 return 26;
207 }
208
209 };
210
211 int operator!= (Q, int)
212 {
213 return 27;
214 }
215
216 int operator!= (Q, double)
217 {
218 return 28;
219 }
220
221 int operator+ (Q, int)
222 {
223 return 29;
224 }
225
226 int operator++ (Q)
227 {
228 return 30;
229 }
230}
231
232//------------
233
450ca57c
SW
234class R {
235 public:
236 int rfoo(){ return 31; }
237 int rbar(){
238 return 1; // marker1
239 }
240};
241
242//------------
243
7322dca9
SW
244int
245main ()
246{
247 A::C c;
248 B b;
249
250 A::first (c);
251 first (0, c);
252 second (0, 0, c, 0, 0);
36b11add 253 entry (c);
7322dca9
SW
254 A::first (b.c);
255
256 E::O eo;
257 F::O fo;
258 G::O go;
259
260 foo (eo);
261 foo (eo, eo);
262 foo (eo, eo, 1);
263 foo (fo, eo);
264 foo (1 ,fo, eo);
265 foo (go, fo, eo);
266
267 I::O io;
268 I::X ix;
269
270 foo (io);
271//foo (ix);
272
273 J::U ju;
274 J::S js;
275 J::E je;
276 J::A::B jab;
277 J::A *jap;
278 J::A **japp;
279 J::C jca[3];
280
281 foo (ju);
282 foo (js);
283 foo (je);
284 foo (jab);
285 foo (jap);
286 foo (japp);
287 foo (jca);
288
289 K::O ko;
290 foo (ko, 1);
291 foo (ko, 1.0f);
292 //bar(ko,1);
293
294 L::A::B::O labo;
295 foo (labo);
296
297 M::A ma;
298 foo(ma,'a');
299 ma.foo('a');
300 M::N::foo(ma,'a');
301
302 M::bar('a');
303 M::N::bar('a');
304
305 TTOA ttoa;
306 foo (ttoa, 'a');
307
4c3376c8
SW
308 P::Q q;
309 q == 5;
310 q == 5.0f;
311 q != 5;
312 q != 5.0f;
313 q + 5;
314 q + 5.0f;
315
316 ++q;
317
450ca57c
SW
318 R r;
319 r.rbar();
320 r.rfoo();
321
7322dca9
SW
322 return first (0, c) + foo (eo) +
323 foo (eo, eo) + foo (eo, eo, 1) +
324 foo (fo, eo) + foo (1 ,fo, eo) +
325 foo (go, fo, eo);
326}
This page took 0.688071 seconds and 4 git commands to generate.