aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.cp/koenig.cc
blob: 01e2637cfbd7d92896697eb5cecc1fd3ac56034e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
namespace A
{
  class C
  {
  public:
    static const int x = 11;
  };

  int
  first (C c)
  {
    return 11;
  }

  int
  first (int a, C c)
  {
    return 22;
  }

  int
  second (int a, int b, C cc, int c, int d)
  {
    return 33;
  }

  int
  entry (C c)
  {
    return 44;
  }
}

struct B
{
  A::C c;
};

//------------

namespace E
{
  class O{};
  int foo (O o){return 1; }
  int foo (O o, O o2){return 2; }
  int foo (O o, O o2, int i){return 3; }
}

namespace F
{
  class O{};
  int foo (       O fo, ::E::O eo){ return 4;}
  int foo (int i, O fo, ::E::O eo){ return 5;}
}

namespace G
{
  class O{};
  int foo (O go, ::F::O fo, ::E::O eo){ return 6; }
}

//------------

namespace H
{
  class O{};
  int foo (O){ return 7;}
}

namespace I
{
  class O: public H::O {};
  class X: H::O{};
}

//------------

namespace J
{
  union U{};
  struct S{};
  enum E{};

  class A{
  public:
    class B{};
  };

  class C{};

  int foo (U){ return 8;}
  int foo (S){ return 9;}
  int foo (E){ return 10;}
  int foo (A::B){ return 11;}
  int foo (A*){ return 12;}
  int foo (A**){ return 13;}
  int foo (C[]){ return 14;}

}
//------------

namespace K{
  class O{};

  int foo(O, int){
    return 15;
  }

  int bar(O, int){
    return 15;
  }
}

int foo(K::O, float){
  return 16;
}

int bar(K::O, int){
  return 16;
}
//------------

namespace L {
  namespace A{
    namespace B{
    class O {};

    int foo (O){
      return 17;
    }

    }
  }
}

//------------

namespace M {
  class A{
  public:
    int foo(char) {
      return 18;
    }
  };

  int foo(A,char){
      return 19;
  }

  int foo(A *,char){
    return 23;
  }

  int bar(char){
    return 21;
  }

  namespace N {
    int foo(::M::A,int){
      return 20;
    }

    int bar(int){
      return 22;
    }
  }
}
//------------

namespace O {
  class A{};

  int foo(A,int){
    return 23;
  }

}

typedef O::A TOA;
typedef TOA  TTOA;

//------------

static union {
    int  a;
    char b;
}p_union;

//------------

namespace P {
  class Q{
  public:
    int operator== (int)
      {
        return 24;
      }

    int operator== (float)
      {
        return 25;
      }

    int operator+ (float)
      {
        return 26;
      }

  };

  int operator!= (Q, int)
    {
      return 27;
    }

  int operator!= (Q, double)
    {
      return 28;
    }

  int operator+ (Q, int)
    {
      return 29;
    }

  int operator++ (Q)
    {
      return 30;
    }
}

//------------

class R {
  public:
    int rfoo(){ return 31; }
    int rbar(){
      return 1; // marker1
    }
};

//------------

int
main ()
{
  A::C c;
  B b;

  A::first (c);
  first (0, c);
  second (0, 0, c, 0, 0);
  entry (c);
  A::first (b.c);

  E::O eo;
  F::O fo;
  G::O go;

  foo (eo);
  foo (eo, eo);
  foo (eo, eo, 1);
  foo (fo, eo);
  foo (1  ,fo, eo);
  foo (go, fo, eo);

  I::O io;
  I::X ix;

  foo (io);
//foo (ix);

  J::U ju;
  J::S js;
  J::E je;
  J::A::B jab;
  J::A *jap;
  J::A **japp;
  J::C jca[3];

  foo (ju);
  foo (js);
  foo (je);
  foo (jab);
  foo (jap);
  foo (japp);
  foo (jca);

  K::O ko;
  foo (ko, 1);
  foo (ko, 1.0f);
  //bar(ko,1);

  L::A::B::O labo;
  foo (labo);
  
  M::A ma;
  foo(ma,'a');
  ma.foo('a');
  M::N::foo(ma,'a');

  M::bar('a');
  M::N::bar('a');

  TTOA ttoa;
  foo (ttoa, 'a');

  P::Q q;
  q == 5;
  q == 5.0f;
  q != 5;
  q != 5.0f;
  q + 5;
  q + 5.0f;

  ++q;

  R r;
  r.rbar();
  r.rfoo();

  return first (0, c) + foo (eo) +
         foo (eo, eo) + foo (eo, eo, 1)  +
         foo (fo, eo) + foo (1  ,fo, eo) +
         foo (go, fo, eo);
}