1 // I, Howard Hinnant, hereby place this code in the public domain.
3 // Test overload resolution among reference types
5 // { dg-do compile { target c++11 } }
6 // { dg-options "-fno-ipa-icf" }
8 template <bool> struct sa;
9 template <> struct sa<true> {};
11 struct one {char x[1];};
12 struct two {char x[2];};
13 struct three {char x[3];};
14 struct four {char x[4];};
15 struct five {char x[5];};
16 struct six {char x[6];};
17 struct seven {char x[7];};
18 struct eight {char x[8];};
23 A(const volatile A&&);
28 volatile A v_source();
29 const volatile A cv_source();
34 two sink_3_123(const A&);
35 three sink_3_123(volatile A&);
40 const A ca = a; // { dg-error "deleted" }
42 const volatile A cva = a; // { dg-error "deleted" }
43 sink_3_123(cva); // { dg-error "" }
44 sink_3_123(v_source()); // { dg-error "" }
45 sink_3_123(cv_source()); // { dg-error "" }
50 two sink_3_125(const A&);
51 five sink_3_125( A&&);
54 two sink_3_124(const A&);
55 four sink_3_124(const volatile A&);
60 const A ca = a; // { dg-error "deleted" }
62 const volatile A cva = a; // { dg-error "deleted" }
63 sink_3_124(v_source()); // { dg-error "" }
64 sink_3_124(cv_source()); // { dg-error "" }
71 const A ca = a; // { dg-error "deleted" }
73 const volatile A cva = a; // { dg-error "deleted" }
74 sink_3_125(va); // { dg-error "" }
75 sink_3_125(cva); // { dg-error "" }
76 sink_3_125(v_source()); // { dg-error "" }
77 sink_3_125(cv_source()); // { dg-error "" }
82 two sink_3_126(const A&);
83 six sink_3_126(const A&&);
88 const A ca = a; // { dg-error "deleted" }
90 const volatile A cva = a; // { dg-error "deleted" }
91 sink_3_126(va); // { dg-error "" }
92 sink_3_126(cva); // { dg-error "" }
93 sink_3_126(v_source()); // { dg-error "" }
94 sink_3_126(cv_source()); // { dg-error "" }
99 two sink_3_127(const A&);
100 seven sink_3_127(volatile A&&);
105 const A ca = a; // { dg-error "deleted" }
107 const volatile A cva = a; // { dg-error "deleted" }
108 sink_3_127(va); // { dg-error "" }
109 sink_3_127(cva); // { dg-error "" }
110 sink_3_127(cv_source()); // { dg-error "" }
115 two sink_3_128(const A&);
116 eight sink_3_128(const volatile A&&);
121 const A ca = a; // { dg-error "deleted" }
123 const volatile A cva = a; // { dg-error "deleted" }
125 sink_3_128(va); // { dg-error "" }
126 sink_3_128(cva); // { dg-error "" }
131 three sink_3_134(volatile A&);
132 four sink_3_134(const volatile A&);
137 const A ca = a; // { dg-error "deleted" }
139 const volatile A cva = a; // { dg-error "deleted" }
140 sink_3_134(source()); // { dg-error "" }
141 sink_3_134(c_source()); // { dg-error "" }
142 sink_3_134(v_source()); // { dg-error "" }
143 sink_3_134(cv_source()); // { dg-error "" }
148 three sink_3_135(volatile A&);
149 five sink_3_135( A&&);
154 const A ca = a; // { dg-error "deleted" }
156 const volatile A cva = a; // { dg-error "deleted" }
157 sink_3_135(ca); // { dg-error "" }
158 sink_3_135(cva); // { dg-error "" }
159 sink_3_135(c_source()); // { dg-error "" }
160 sink_3_135(v_source()); // { dg-error "" }
161 sink_3_135(cv_source()); // { dg-error "" }
166 three sink_3_136(volatile A&);
167 six sink_3_136(const A&&);
172 const A ca = a; // { dg-error "deleted" }
174 const volatile A cva = a; // { dg-error "deleted" }
175 sink_3_136(ca); // { dg-error "" }
176 sink_3_136(cva); // { dg-error "" }
177 sink_3_136(v_source()); // { dg-error "" }
178 sink_3_136(cv_source()); // { dg-error "" }
183 three sink_3_137(volatile A&);
184 seven sink_3_137(volatile A&&);
189 const A ca = a; // { dg-error "deleted" }
191 const volatile A cva = a; // { dg-error "deleted" }
192 sink_3_137(ca); // { dg-error "" }
193 sink_3_137(cva); // { dg-error "" }
194 sink_3_137(c_source()); // { dg-error "" }
195 sink_3_137(cv_source()); // { dg-error "" }
200 three sink_3_138(volatile A&);
201 eight sink_3_138(const volatile A&&);
206 const A ca = a; // { dg-error "deleted" }
208 const volatile A cva = a; // { dg-error "deleted" }
209 sink_3_138(ca); // { dg-error "" }
210 sink_3_138(cva); // { dg-error "" }
215 four sink_3_145(const volatile A&);
216 five sink_3_145( A&&);
221 const A ca = a; // { dg-error "deleted" }
223 const volatile A cva = a; // { dg-error "deleted" }
224 sink_3_145(c_source()); // { dg-error "" }
225 sink_3_145(v_source()); // { dg-error "" }
226 sink_3_145(cv_source()); // { dg-error "" }
231 four sink_3_146(const volatile A&);
232 six sink_3_146(const A&&);
237 const A ca = a; // { dg-error "deleted" }
239 const volatile A cva = a; // { dg-error "deleted" }
240 sink_3_146(v_source()); // { dg-error "" }
241 sink_3_146(cv_source()); // { dg-error "" }
246 four sink_3_147(const volatile A&);
247 seven sink_3_147(volatile A&&);
252 const A ca = a; // { dg-error "deleted" }
254 const volatile A cva = a; // { dg-error "deleted" }
255 sink_3_147(c_source()); // { dg-error "" }
256 sink_3_147(cv_source()); // { dg-error "" }
261 five sink_3_156( A&&);
262 six sink_3_156(const A&&);
267 const A ca = a; // { dg-error "deleted" }
269 const volatile A cva = a; // { dg-error "deleted" }
270 sink_3_156(ca); // { dg-error "" }
271 sink_3_156(va); // { dg-error "" }
272 sink_3_156(cva); // { dg-error "" }
273 sink_3_156(v_source()); // { dg-error "" }
274 sink_3_156(cv_source()); // { dg-error "" }
279 five sink_3_157( A&&);
280 seven sink_3_157(volatile A&&);
285 const A ca = a; // { dg-error "deleted" }
287 const volatile A cva = a; // { dg-error "deleted" }
288 sink_3_157(ca); // { dg-error "" }
289 sink_3_157(va); // { dg-error "" }
290 sink_3_157(cva); // { dg-error "" }
291 sink_3_157(c_source()); // { dg-error "" }
292 sink_3_157(cv_source()); // { dg-error "" }
297 five sink_3_158( A&&);
298 eight sink_3_158(const volatile A&&);
303 const A ca = a; // { dg-error "deleted" }
305 const volatile A cva = a; // { dg-error "deleted" }
306 sink_3_158(ca); // { dg-error "" }
307 sink_3_158(va); // { dg-error "" }
308 sink_3_158(cva); // { dg-error "" }
313 six sink_3_167(const A&&);
314 seven sink_3_167(volatile A&&);
319 const A ca = a; // { dg-error "deleted" }
321 const volatile A cva = a; // { dg-error "deleted" }
322 sink_3_167(ca); // { dg-error "" }
323 sink_3_167(va); // { dg-error "" }
324 sink_3_167(cva); // { dg-error "" }
325 sink_3_167(source()); // { dg-error "" }
326 sink_3_167(cv_source()); // { dg-error "" }
331 six sink_3_168(const A&&);
332 eight sink_3_168(const volatile A&&);
337 const A ca = a; // { dg-error "deleted" }
339 const volatile A cva = a; // { dg-error "deleted" }
340 sink_3_168(ca); // { dg-error "" }
341 sink_3_168(va); // { dg-error "" }
342 sink_3_168(cva); // { dg-error "" }
347 seven sink_3_178(volatile A&&);
348 eight sink_3_178(const volatile A&&);
353 const A ca = a; // { dg-error "deleted" }
355 const volatile A cva = a; // { dg-error "deleted" }
356 sink_3_178(ca); // { dg-error "" }
357 sink_3_178(va); // { dg-error "" }
358 sink_3_178(cva); // { dg-error "" }
362 two sink_3_234(const A&);
363 three sink_3_234(volatile A&);
364 four sink_3_234(const volatile A&);
369 const A ca = a; // { dg-error "deleted" }
371 const volatile A cva = a; // { dg-error "deleted" }
372 sink_3_234(a); // { dg-error "" }
373 sink_3_234(v_source()); // { dg-error "" }
374 sink_3_234(cv_source()); // { dg-error "" }
378 two sink_3_235(const A&);
379 three sink_3_235(volatile A&);
380 five sink_3_235( A&&);
385 const A ca = a; // { dg-error "deleted" }
387 const volatile A cva = a; // { dg-error "deleted" }
388 sink_3_235(a); // { dg-error "" }
389 sink_3_235(cva); // { dg-error "" }
390 sink_3_235(v_source()); // { dg-error "" }
391 sink_3_235(cv_source()); // { dg-error "" }
395 two sink_3_236(const A&);
396 three sink_3_236(volatile A&);
397 six sink_3_236(const A&&);
402 const A ca = a; // { dg-error "deleted" }
404 const volatile A cva = a; // { dg-error "deleted" }
405 sink_3_236(a); // { dg-error "" }
406 sink_3_236(cva); // { dg-error "" }
407 sink_3_236(v_source()); // { dg-error "" }
408 sink_3_236(cv_source()); // { dg-error "" }
412 two sink_3_237(const A&);
413 three sink_3_237(volatile A&);
414 seven sink_3_237(volatile A&&);
419 const A ca = a; // { dg-error "deleted" }
421 const volatile A cva = a; // { dg-error "deleted" }
422 sink_3_237(a); // { dg-error "" }
423 sink_3_237(cva); // { dg-error "" }
424 sink_3_237(cv_source()); // { dg-error "" }
428 two sink_3_238(const A&);
429 three sink_3_238(volatile A&);
430 eight sink_3_238(const volatile A&&);
435 const A ca = a; // { dg-error "deleted" }
437 const volatile A cva = a; // { dg-error "deleted" }
438 sink_3_238(a); // { dg-error "" }
439 sink_3_238(cva); // { dg-error "" }
443 two sink_3_245(const A&);
444 four sink_3_245(const volatile A&);
445 five sink_3_245( A&&);
450 const A ca = a; // { dg-error "deleted" }
452 const volatile A cva = a; // { dg-error "deleted" }
453 sink_3_245(v_source()); // { dg-error "" }
454 sink_3_245(cv_source()); // { dg-error "" }
458 two sink_3_246(const A&);
459 four sink_3_246(const volatile A&);
460 six sink_3_246(const A&&);
465 const A ca = a; // { dg-error "deleted" }
467 const volatile A cva = a; // { dg-error "deleted" }
468 sink_3_246(v_source()); // { dg-error "" }
469 sink_3_246(cv_source()); // { dg-error "" }
473 two sink_3_247(const A&);
474 four sink_3_247(const volatile A&);
475 seven sink_3_247(volatile A&&);
480 const A ca = a; // { dg-error "deleted" }
482 const volatile A cva = a; // { dg-error "deleted" }
483 sink_3_247(cv_source()); // { dg-error "" }
487 two sink_3_256(const A&);
488 five sink_3_256( A&&);
489 six sink_3_256(const A&&);
494 const A ca = a; // { dg-error "deleted" }
496 const volatile A cva = a; // { dg-error "deleted" }
497 sink_3_256(va); // { dg-error "" }
498 sink_3_256(cva); // { dg-error "" }
499 sink_3_256(v_source()); // { dg-error "" }
500 sink_3_256(cv_source()); // { dg-error "" }
504 two sink_3_257(const A&);
505 five sink_3_257( A&&);
506 seven sink_3_257(volatile A&&);
511 const A ca = a; // { dg-error "deleted" }
513 const volatile A cva = a; // { dg-error "deleted" }
514 sink_3_257(va); // { dg-error "" }
515 sink_3_257(cva); // { dg-error "" }
516 sink_3_257(cv_source()); // { dg-error "" }
520 two sink_3_258(const A&);
521 five sink_3_258( A&&);
522 eight sink_3_258(const volatile A&&);
527 const A ca = a; // { dg-error "deleted" }
529 const volatile A cva = a; // { dg-error "deleted" }
530 sink_3_258(va); // { dg-error "" }
531 sink_3_258(cva); // { dg-error "" }
535 two sink_3_267(const A&);
536 six sink_3_267(const A&&);
537 seven sink_3_267(volatile A&&);
542 const A ca = a; // { dg-error "deleted" }
544 const volatile A cva = a; // { dg-error "deleted" }
545 sink_3_267(va); // { dg-error "" }
546 sink_3_267(cva); // { dg-error "" }
547 sink_3_267(source()); // { dg-error "" }
548 sink_3_267(cv_source()); // { dg-error "" }
552 two sink_3_268(const A&);
553 six sink_3_268(const A&&);
554 eight sink_3_268(const volatile A&&);
559 const A ca = a; // { dg-error "deleted" }
561 const volatile A cva = a; // { dg-error "deleted" }
562 sink_3_268(va); // { dg-error "" }
563 sink_3_268(cva); // { dg-error "" }
567 two sink_3_278(const A&);
568 seven sink_3_278(volatile A&&);
569 eight sink_3_278(const volatile A&&);
574 const A ca = a; // { dg-error "deleted" }
576 const volatile A cva = a; // { dg-error "deleted" }
577 sink_3_278(va); // { dg-error "" }
578 sink_3_278(cva); // { dg-error "" }
582 three sink_3_345(volatile A&);
583 four sink_3_345(const volatile A&);
584 five sink_3_345( A&&);
589 const A ca = a; // { dg-error "deleted" }
591 const volatile A cva = a; // { dg-error "deleted" }
592 sink_3_345(c_source()); // { dg-error "" }
593 sink_3_345(v_source()); // { dg-error "" }
594 sink_3_345(cv_source()); // { dg-error "" }
598 three sink_3_346(volatile A&);
599 four sink_3_346(const volatile A&);
600 six sink_3_346(const A&&);
605 const A ca = a; // { dg-error "deleted" }
607 const volatile A cva = a; // { dg-error "deleted" }
608 sink_3_346(v_source()); // { dg-error "" }
609 sink_3_346(cv_source()); // { dg-error "" }
613 three sink_3_347(volatile A&);
614 four sink_3_347(const volatile A&);
615 seven sink_3_347(volatile A&&);
620 const A ca = a; // { dg-error "deleted" }
622 const volatile A cva = a; // { dg-error "deleted" }
623 sink_3_347(c_source()); // { dg-error "" }
624 sink_3_347(cv_source()); // { dg-error "" }
628 three sink_3_356(volatile A&);
629 five sink_3_356( A&&);
630 six sink_3_356(const A&&);
635 const A ca = a; // { dg-error "deleted" }
637 const volatile A cva = a; // { dg-error "deleted" }
638 sink_3_356(ca); // { dg-error "" }
639 sink_3_356(cva); // { dg-error "" }
640 sink_3_356(v_source()); // { dg-error "" }
641 sink_3_356(cv_source()); // { dg-error "" }
645 three sink_3_357(volatile A&);
646 five sink_3_357( A&&);
647 seven sink_3_357(volatile A&&);
652 const A ca = a; // { dg-error "deleted" }
654 const volatile A cva = a; // { dg-error "deleted" }
655 sink_3_357(ca); // { dg-error "" }
656 sink_3_357(cva); // { dg-error "" }
657 sink_3_357(c_source()); // { dg-error "" }
658 sink_3_357(cv_source()); // { dg-error "" }
662 three sink_3_358(volatile A&);
663 five sink_3_358( A&&);
664 eight sink_3_358(const volatile A&&);
669 const A ca = a; // { dg-error "deleted" }
671 const volatile A cva = a; // { dg-error "deleted" }
672 sink_3_358(ca); // { dg-error "" }
673 sink_3_358(cva); // { dg-error "" }
677 three sink_3_367(volatile A&);
678 six sink_3_367(const A&&);
679 seven sink_3_367(volatile A&&);
684 const A ca = a; // { dg-error "deleted" }
686 const volatile A cva = a; // { dg-error "deleted" }
687 sink_3_367(ca); // { dg-error "" }
688 sink_3_367(cva); // { dg-error "" }
689 sink_3_367(source()); // { dg-error "" }
690 sink_3_367(cv_source()); // { dg-error "" }
694 three sink_3_368(volatile A&);
695 six sink_3_368(const A&&);
696 eight sink_3_368(const volatile A&&);
701 const A ca = a; // { dg-error "deleted" }
703 const volatile A cva = a; // { dg-error "deleted" }
704 sink_3_368(ca); // { dg-error "" }
705 sink_3_368(cva); // { dg-error "" }
709 three sink_3_378(volatile A&);
710 seven sink_3_378(volatile A&&);
711 eight sink_3_378(const volatile A&&);
716 const A ca = a; // { dg-error "deleted" }
718 const volatile A cva = a; // { dg-error "deleted" }
719 sink_3_378(ca); // { dg-error "" }
720 sink_3_378(cva); // { dg-error "" }
724 four sink_3_456(const volatile A&);
725 five sink_3_456( A&&);
726 six sink_3_456(const A&&);
731 const A ca = a; // { dg-error "deleted" }
733 const volatile A cva = a; // { dg-error "deleted" }
734 sink_3_456(v_source()); // { dg-error "" }
735 sink_3_456(cv_source()); // { dg-error "" }
739 four sink_3_457(const volatile A&);
740 five sink_3_457( A&&);
741 seven sink_3_457(volatile A&&);
746 const A ca = a; // { dg-error "deleted" }
748 const volatile A cva = a; // { dg-error "deleted" }
749 sink_3_457(c_source()); // { dg-error "" }
750 sink_3_457(cv_source()); // { dg-error "" }
754 four sink_3_467(const volatile A&);
755 six sink_3_467(const A&&);
756 seven sink_3_467(volatile A&&);
761 const A ca = a; // { dg-error "deleted" }
763 const volatile A cva = a; // { dg-error "deleted" }
764 sink_3_467(source()); // { dg-error "" }
765 sink_3_467(cv_source()); // { dg-error "" }
769 five sink_3_567( A&&);
770 six sink_3_567(const A&&);
771 seven sink_3_567(volatile A&&);
776 const A ca = a; // { dg-error "deleted" }
778 const volatile A cva = a; // { dg-error "deleted" }
779 sink_3_567(a); // { dg-error "" }
780 sink_3_567(ca); // { dg-error "" }
781 sink_3_567(va); // { dg-error "" }
782 sink_3_567(cva); // { dg-error "" }
783 sink_3_567(cv_source()); // { dg-error "" }
787 five sink_3_568( A&&);
788 six sink_3_568(const A&&);
789 eight sink_3_568(const volatile A&&);
794 const A ca = a; // { dg-error "deleted" }
796 const volatile A cva = a; // { dg-error "deleted" }
797 sink_3_568(a); // { dg-error "" }
798 sink_3_568(ca); // { dg-error "" }
799 sink_3_568(va); // { dg-error "" }
800 sink_3_568(cva); // { dg-error "" }
804 five sink_3_578( A&&);
805 seven sink_3_578(volatile A&&);
806 eight sink_3_578(const volatile A&&);
811 const A ca = a; // { dg-error "deleted" }
813 const volatile A cva = a; // { dg-error "deleted" }
814 sink_3_578(a); // { dg-error "" }
815 sink_3_578(ca); // { dg-error "" }
816 sink_3_578(va); // { dg-error "" }
817 sink_3_578(cva); // { dg-error "" }
821 six sink_3_678(const A&&);
822 seven sink_3_678(volatile A&&);
823 eight sink_3_678(const volatile A&&);
828 const A ca = a; // { dg-error "deleted" }
830 const volatile A cva = a; // { dg-error "deleted" }
831 sink_3_678(a); // { dg-error "" }
832 sink_3_678(ca); // { dg-error "" }
833 sink_3_678(va); // { dg-error "" }
834 sink_3_678(cva); // { dg-error "" }
835 sink_3_678(source()); // { dg-error "" }
841 return test3_123() + test3_125() + test3_126() + test3_127() +
842 test3_135() + test3_136() + test3_137() + test3_156() +
843 test3_157() + test3_167() + test3_234() + test3_235() +
844 test3_236() + test3_237() + test3_238() + test3_256() +
845 test3_257() + test3_267() + test3_356() + test3_357() +
846 test3_367() + test3_467() + test3_567() + test3_678();