1 // I, Howard Hinnant, hereby place this code in the public domain.
2 /* { dg-additional-options "-fno-ipa-icf" } */
4 // Test overload resolution among reference types
6 // { dg-do compile { target c++11 } }
7 // { dg-additional-options "-fno-ipa-icf" }
9 template <bool> struct sa;
10 template <> struct sa<true> {};
12 struct one {char x[1];};
13 struct two {char x[2];};
14 struct three {char x[3];};
15 struct four {char x[4];};
16 struct five {char x[5];};
17 struct six {char x[6];};
18 struct seven {char x[7];};
19 struct eight {char x[8];};
24 A(const volatile A&&);
29 volatile A v_source(); // { dg-warning "deprecated" "" { target c++2a } }
30 const volatile A cv_source(); // { dg-warning "deprecated" "" { target c++2a } }
34 one sink_1_1( A&); // { dg-message "" }
39 const A ca = a; // { dg-error "deleted" }
41 const volatile A cva = a; // { dg-error "deleted" }
42 sink_1_1(ca); // { dg-error "" }
43 sink_1_1(va); // { dg-error "" }
44 sink_1_1(cva); // { dg-error "" }
45 sink_1_1(source()); // { dg-error "" }
46 sink_1_1(c_source()); // { dg-error "" }
47 sink_1_1(v_source()); // { dg-error "" }
48 sink_1_1(cv_source()); // { dg-error "" }
52 two sink_1_2(const A&); // { dg-message "" }
57 const A ca = a; // { dg-error "deleted" }
59 const volatile A cva = a; // { dg-error "deleted" }
60 sink_1_2(va); // { dg-error "" }
61 sink_1_2(cva); // { dg-error "" }
62 sink_1_2(v_source()); // { dg-error "" }
63 sink_1_2(cv_source()); // { dg-error "" }
67 three sink_1_3(volatile A&); // { dg-message "" }
72 const A ca = a; // { dg-error "deleted" }
74 const volatile A cva = a; // { dg-error "deleted" }
75 sink_1_3(ca); // { dg-error "" }
76 sink_1_3(cva); // { dg-error "" }
77 sink_1_3(source()); // { dg-error "" }
78 sink_1_3(c_source()); // { dg-error "" }
79 sink_1_3(v_source()); // { dg-error "" }
80 sink_1_3(cv_source()); // { dg-error "" }
84 four sink_1_4(const volatile A&); // { dg-message "" }
89 const A ca = a; // { dg-error "deleted" }
91 const volatile A cva = a; // { dg-error "deleted" }
92 sink_1_4(source()); // { dg-error "" }
93 sink_1_4(c_source()); // { dg-error "" }
94 sink_1_4(v_source()); // { dg-error "" }
95 sink_1_4(cv_source()); // { dg-error "" }
99 five sink_1_5( A&&); // { dg-message "" }
104 const A ca = a; // { dg-error "deleted" }
106 const volatile A cva = a; // { dg-error "deleted" }
107 sink_1_5(a); // { dg-error "lvalue" }
108 sink_1_5(ca); // { dg-error "" }
109 sink_1_5(va); // { dg-error "" }
110 sink_1_5(cva); // { dg-error "" }
111 sink_1_5(c_source()); // { dg-error "" }
112 sink_1_5(v_source()); // { dg-error "" }
113 sink_1_5(cv_source()); // { dg-error "" }
117 six sink_1_6(const A&&); // { dg-message "" }
122 const A ca = a; // { dg-error "deleted" }
124 const volatile A cva = a; // { dg-error "deleted" }
125 sink_1_6(a); // { dg-error "lvalue" }
126 sink_1_6(ca); // { dg-error "lvalue" }
127 sink_1_6(va); // { dg-error "" }
128 sink_1_6(cva); // { dg-error "" }
129 sink_1_6(v_source()); // { dg-error "" }
130 sink_1_6(cv_source()); // { dg-error "" }
134 seven sink_1_7(volatile A&&); // { dg-message "" }
139 const A ca = a; // { dg-error "deleted" }
141 const volatile A cva = a; // { dg-error "deleted" }
142 sink_1_7(a); // { dg-error "lvalue" }
143 sink_1_7(ca); // { dg-error "" }
144 sink_1_7(va); // { dg-error "lvalue" }
145 sink_1_7(cva); // { dg-error "" }
146 sink_1_7(c_source()); // { dg-error "" }
147 sink_1_7(cv_source()); // { dg-error "" }
151 eight sink_1_8(const volatile A&&); // { dg-message "" }
156 const A ca = a; // { dg-error "deleted" }
158 const volatile A cva = a; // { dg-error "deleted" }
159 sink_1_8(a); // { dg-error "lvalue" }
160 sink_1_8(ca); // { dg-error "lvalue" }
161 sink_1_8(va); // { dg-error "lvalue" }
162 sink_1_8(cva); // { dg-error "lvalue" }
168 return test1_1() + test1_2() + test1_3() + test1_5() +
169 test1_6() + test1_7();