Debian Codegraph @

gcc/testsuite/g++.dg/cpp23/explicit-obj-basic3.C

raw
1 // P0847R7
2 // { dg-do compile { target c++23 } }
3
4 // bogus diagnosis of valid declarations as redeclarations
5 // tests for by-value are elsewhere (todo: add filename)
6
7 // each group has 8 overloads that each take
8 // lvalue ref to S
9 // rvalue ref to S
10 // lvalue c ref to S
11 // rvalue c ref to S
12 // lvalue v ref to S
13 // rvalue v ref to S
14 // lvalue cv ref to S
15 // rvalue cv ref to S
16 // where S is the struct the function is declared in
17
18 // only xobj (the most basic case)
19
20 struct S {
21 void f(this S &);
22 void f(this S &&);
23 void f(this S const&);
24 void f(this S const&&);
25 void f(this S volatile&);
26 void f(this S volatile&&);
27 void f(this S const volatile&);
28 void f(this S const volatile&&);
29 };
30
31 // I* has the 1 xobj 7 iobj cases
32 // X* has the 7 xobj 1 iobj cases
33 // *0 has the unique function first, the rest after
34 // *1 has the unique function last, the rest after
35 // *2 has the functions in the order stated above
36 // xobj first, 1 xobj, 7 iobj
37
38 // (yes there are some redundant cases)
39
40 // unique first, 1 xobj 7 iobj
41
42 struct I0 {
43 void f0(this I0&);
44 void f0() &&;
45 void f0() const&;
46 void f0() const&&;
47 void f0() volatile&;
48 void f0() volatile&&;
49 void f0() const volatile&;
50 void f0() const volatile&&;
51
52 void f1(this I0&&);
53 void f1() &;
54 void f1() const&;
55 void f1() const&&;
56 void f1() volatile&;
57 void f1() volatile&&;
58 void f1() const volatile&;
59 void f1() const volatile&&;
60
61 void fc0(this I0 const&);
62 void fc0() &;
63 void fc0() &&;
64 void fc0() const&&;
65 void fc0() volatile&;
66 void fc0() volatile&&;
67 void fc0() const volatile&;
68 void fc0() const volatile&&;
69
70 void fc1(this I0 const&&);
71 void fc1() &;
72 void fc1() &&;
73 void fc1() const&;
74 void fc1() volatile&;
75 void fc1() volatile&&;
76 void fc1() const volatile&;
77 void fc1() const volatile&&;
78
79 void fv0(this I0 volatile&);
80 void fv0() &;
81 void fv0() &&;
82 void fv0() const&;
83 void fv0() const&&;
84 void fv0() volatile&&;
85 void fv0() const volatile&;
86 void fv0() const volatile&&;
87
88 void fv1(this I0 volatile&&);
89 void fv1() &;
90 void fv1() &&;
91 void fv1() const&;
92 void fv1() const&&;
93 void fv1() volatile&;
94 void fv1() const volatile&;
95 void fv1() const volatile&&;
96
97 void fcv0(this I0 const volatile&);
98 void fcv0() &;
99 void fcv0() &&;
100 void fcv0() const&;
101 void fcv0() const&&;
102 void fcv0() volatile&;
103 void fcv0() volatile&&;
104 void fcv0() const volatile&&;
105
106 void fcv1(this I0 const volatile&&);
107 void fcv1() &;
108 void fcv1() &&;
109 void fcv1() const&;
110 void fcv1() const&&;
111 void fcv1() volatile&;
112 void fcv1() volatile&&;
113 void fcv1() const volatile&;
114 };
115
116 // unique last, 1 xobj 7 iobj
117
118 struct I1 {
119 void f0() &&;
120 void f0() const&;
121 void f0() const&&;
122 void f0() volatile&;
123 void f0() volatile&&;
124 void f0() const volatile&;
125 void f0() const volatile&&;
126 void f0(this I1&);
127
128 void f1() &;
129 void f1() const&;
130 void f1() const&&;
131 void f1() volatile&;
132 void f1() volatile&&;
133 void f1() const volatile&;
134 void f1() const volatile&&;
135 void f1(this I1&&);
136
137 void fc0() &;
138 void fc0() &&;
139 void fc0() const&&;
140 void fc0() volatile&;
141 void fc0() volatile&&;
142 void fc0() const volatile&;
143 void fc0() const volatile&&;
144 void fc0(this I1 const&);
145
146 void fc1() &;
147 void fc1() &&;
148 void fc1() const&;
149 void fc1() volatile&;
150 void fc1() volatile&&;
151 void fc1() const volatile&;
152 void fc1() const volatile&&;
153 void fc1(this I1 const&&);
154
155 void fv0() &;
156 void fv0() &&;
157 void fv0() const&;
158 void fv0() const&&;
159 void fv0() volatile&&;
160 void fv0() const volatile&;
161 void fv0() const volatile&&;
162 void fv0(this I1 volatile&);
163
164 void fv1() &;
165 void fv1() &&;
166 void fv1() const&;
167 void fv1() const&&;
168 void fv1() volatile&;
169 void fv1() const volatile&;
170 void fv1() const volatile&&;
171 void fv1(this I1 volatile&&);
172
173 void fcv0() &;
174 void fcv0() &&;
175 void fcv0() const&;
176 void fcv0() const&&;
177 void fcv0() volatile&;
178 void fcv0() volatile&&;
179 void fcv0() const volatile&&;
180 void fcv0(this I1 const volatile&);
181
182 void fcv1() &;
183 void fcv1() &&;
184 void fcv1() const&;
185 void fcv1() const&&;
186 void fcv1() volatile&;
187 void fcv1() volatile&&;
188 void fcv1() const volatile&;
189 void fcv1(this I1 const volatile&&);
190 };
191
192 // ordered, 1 xobj 7 iobj
193
194 struct I2 {
195 void f0(this I2&);
196 void f0() &&;
197 void f0() const&;
198 void f0() const&&;
199 void f0() volatile&;
200 void f0() volatile&&;
201 void f0() const volatile&;
202 void f0() const volatile&&;
203
204 void f1() &;
205 void f1(this I2&&);
206 void f1() const&;
207 void f1() const&&;
208 void f1() volatile&;
209 void f1() volatile&&;
210 void f1() const volatile&;
211 void f1() const volatile&&;
212
213 void fc0() &;
214 void fc0() &&;
215 void fc0(this I2 const&);
216 void fc0() const&&;
217 void fc0() volatile&;
218 void fc0() volatile&&;
219 void fc0() const volatile&;
220 void fc0() const volatile&&;
221
222 void fc1() &;
223 void fc1() &&;
224 void fc1() const&;
225 void fc1(this I2 const&&);
226 void fc1() volatile&;
227 void fc1() volatile&&;
228 void fc1() const volatile&;
229 void fc1() const volatile&&;
230
231 void fv0() &;
232 void fv0() &&;
233 void fv0() const&;
234 void fv0() const&&;
235 void fv0(this I2 volatile&);
236 void fv0() volatile&&;
237 void fv0() const volatile&;
238 void fv0() const volatile&&;
239
240 void fv1() &;
241 void fv1() &&;
242 void fv1() const&;
243 void fv1() const&&;
244 void fv1() volatile&;
245 void fv1(this I2 volatile&&);
246 void fv1() const volatile&;
247 void fv1() const volatile&&;
248
249 void fcv0() &;
250 void fcv0() &&;
251 void fcv0() const&;
252 void fcv0() const&&;
253 void fcv0() volatile&;
254 void fcv0() volatile&&;
255 void fcv0(this I2 const volatile&);
256 void fcv0() const volatile&&;
257
258 void fcv1() &;
259 void fcv1() &&;
260 void fcv1() const&;
261 void fcv1() const&&;
262 void fcv1() volatile&;
263 void fcv1() volatile&&;
264 void fcv1() const volatile&;
265 void fcv1(this I2 const volatile&&);
266 };
267
268
269 // iobj first, 7 xobj, 1 iobj
270
271 struct X0 {
272 void f0() &;
273 void f0(this X0 &&);
274 void f0(this X0 const&);
275 void f0(this X0 const&&);
276 void f0(this X0 volatile&);
277 void f0(this X0 volatile&&);
278 void f0(this X0 const volatile&);
279 void f0(this X0 const volatile&&);
280
281 void f1() &&;
282 void f1(this X0 &);
283 void f1(this X0 const&);
284 void f1(this X0 const&&);
285 void f1(this X0 volatile&);
286 void f1(this X0 volatile&&);
287 void f1(this X0 const volatile&);
288 void f1(this X0 const volatile&&);
289
290 void fc0() const&;
291 void fc0(this X0 &);
292 void fc0(this X0 &&);
293 void fc0(this X0 const&&);
294 void fc0(this X0 volatile&);
295 void fc0(this X0 volatile&&);
296 void fc0(this X0 const volatile&);
297 void fc0(this X0 const volatile&&);
298
299 void fc1() const&&;
300 void fc1(this X0 &);
301 void fc1(this X0 &&);
302 void fc1(this X0 const&);
303 void fc1(this X0 volatile&);
304 void fc1(this X0 volatile&&);
305 void fc1(this X0 const volatile&);
306 void fc1(this X0 const volatile&&);
307
308 void fv0() volatile&;
309 void fv0(this X0 &);
310 void fv0(this X0 &&);
311 void fv0(this X0 const&);
312 void fv0(this X0 const&&);
313 void fv0(this X0 volatile&&);
314 void fv0(this X0 const volatile&);
315 void fv0(this X0 const volatile&&);
316
317 void fv1() volatile&&;
318 void fv1(this X0 &);
319 void fv1(this X0 &&);
320 void fv1(this X0 const&);
321 void fv1(this X0 const&&);
322 void fv1(this X0 volatile&);
323 void fv1(this X0 const volatile&);
324 void fv1(this X0 const volatile&&);
325
326 void fcv0() const volatile&;
327 void fcv0(this X0 &);
328 void fcv0(this X0 &&);
329 void fcv0(this X0 const&);
330 void fcv0(this X0 const&&);
331 void fcv0(this X0 volatile&);
332 void fcv0(this X0 volatile&&);
333 void fcv0(this X0 const volatile&&);
334
335 void fcv1() const volatile&&;
336 void fcv1(this X0 &);
337 void fcv1(this X0 &&);
338 void fcv1(this X0 const&);
339 void fcv1(this X0 const&&);
340 void fcv1(this X0 volatile&);
341 void fcv1(this X0 volatile&&);
342 void fcv1(this X0 const volatile&);
343 };
344
345 // iobj last, 7 xobj 1 iobj
346
347 struct X1 {
348 void f0(this X1 &&);
349 void f0(this X1 const&);
350 void f0(this X1 const&&);
351 void f0(this X1 volatile&);
352 void f0(this X1 volatile&&);
353 void f0(this X1 const volatile&);
354 void f0(this X1 const volatile&&);
355 void f0() &;
356
357 void f1(this X1 &);
358 void f1(this X1 const&);
359 void f1(this X1 const&&);
360 void f1(this X1 volatile&);
361 void f1(this X1 volatile&&);
362 void f1(this X1 const volatile&);
363 void f1(this X1 const volatile&&);
364 void f1() &&;
365
366 void fc0(this X1 &);
367 void fc0(this X1 &&);
368 void fc0(this X1 const&&);
369 void fc0(this X1 volatile&);
370 void fc0(this X1 volatile&&);
371 void fc0(this X1 const volatile&);
372 void fc0(this X1 const volatile&&);
373 void fc0() const&;
374
375 void fc1(this X1 &);
376 void fc1(this X1 &&);
377 void fc1(this X1 const&);
378 void fc1(this X1 volatile&);
379 void fc1(this X1 volatile&&);
380 void fc1(this X1 const volatile&);
381 void fc1(this X1 const volatile&&);
382 void fc1() const&&;
383
384 void fv0(this X1 &);
385 void fv0(this X1 &&);
386 void fv0(this X1 const&);
387 void fv0(this X1 const&&);
388 void fv0(this X1 volatile&&);
389 void fv0(this X1 const volatile&);
390 void fv0(this X1 const volatile&&);
391 void fv0() volatile&;
392
393 void fv1(this X1 &);
394 void fv1(this X1 &&);
395 void fv1(this X1 const&);
396 void fv1(this X1 const&&);
397 void fv1(this X1 volatile&);
398 void fv1(this X1 const volatile&);
399 void fv1(this X1 const volatile&&);
400 void fv1() volatile&&;
401
402 void fcv0(this X1 &);
403 void fcv0(this X1 &&);
404 void fcv0(this X1 const&);
405 void fcv0(this X1 const&&);
406 void fcv0(this X1 volatile&);
407 void fcv0(this X1 volatile&&);
408 void fcv0(this X1 const volatile&&);
409 void fcv0() const volatile&;
410
411 void fcv1(this X1 &);
412 void fcv1(this X1 &&);
413 void fcv1(this X1 const&);
414 void fcv1(this X1 const&&);
415 void fcv1(this X1 volatile&);
416 void fcv1(this X1 volatile&&);
417 void fcv1(this X1 const volatile&);
418 void fcv1() const volatile&&;
419 };
420
421 // ordered, 7 xobj 1 iobj
422
423 struct X2 {
424 void f0() &;
425 void f0(this X2 &&);
426 void f0(this X2 const&);
427 void f0(this X2 const&&);
428 void f0(this X2 volatile&);
429 void f0(this X2 volatile&&);
430 void f0(this X2 const volatile&);
431 void f0(this X2 const volatile&&);
432
433 void f1(this X2 &);
434 void f1() &&;
435 void f1(this X2 const&);
436 void f1(this X2 const&&);
437 void f1(this X2 volatile&);
438 void f1(this X2 volatile&&);
439 void f1(this X2 const volatile&);
440 void f1(this X2 const volatile&&);
441
442 void fc0(this X2 &);
443 void fc0(this X2 &&);
444 void fc0() const&;
445 void fc0(this X2 const&&);
446 void fc0(this X2 volatile&);
447 void fc0(this X2 volatile&&);
448 void fc0(this X2 const volatile&);
449 void fc0(this X2 const volatile&&);
450
451 void fc1(this X2 &);
452 void fc1(this X2 &&);
453 void fc1(this X2 const&);
454 void fc1() const&&;
455 void fc1(this X2 volatile&);
456 void fc1(this X2 volatile&&);
457 void fc1(this X2 const volatile&);
458 void fc1(this X2 const volatile&&);
459
460 void fv0(this X2 &);
461 void fv0(this X2 &&);
462 void fv0(this X2 const&);
463 void fv0(this X2 const&&);
464 void fv0() volatile&;
465 void fv0(this X2 volatile&&);
466 void fv0(this X2 const volatile&);
467 void fv0(this X2 const volatile&&);
468
469 void fv1(this X2 &);
470 void fv1(this X2 &&);
471 void fv1(this X2 const&);
472 void fv1(this X2 const&&);
473 void fv1(this X2 volatile&);
474 void fv1() volatile&&;
475 void fv1(this X2 const volatile&);
476 void fv1(this X2 const volatile&&);
477
478 void fcv0(this X2 &);
479 void fcv0(this X2 &&);
480 void fcv0(this X2 const&);
481 void fcv0(this X2 const&&);
482 void fcv0(this X2 volatile&);
483 void fcv0(this X2 volatile&&);
484 void fcv0() const volatile&;
485 void fcv0(this X2 const volatile&&);
486
487 void fcv1(this X2 &);
488 void fcv1(this X2 &&);
489 void fcv1(this X2 const&);
490 void fcv1(this X2 const&&);
491 void fcv1(this X2 volatile&);
492 void fcv1(this X2 volatile&&);
493 void fcv1(this X2 const volatile&);
494 void fcv1() const volatile&&;
495 };
496