1 // I, Howard Hinnant, hereby place this code in the public domain.
3 // Test overload resolution among reference types
6 // { dg-options "-std=c++0x" }
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();
40 const volatile A cva = a;
41 sa<sizeof(sink_1_1(a)) == 1> t1;
45 two sink_1_2(const A&);
52 const volatile A cva = a;
53 sa<sizeof(sink_1_2(a)) == 2> t1;
54 sa<sizeof(sink_1_2(ca)) == 2> t2;
55 sa<sizeof(sink_1_2(source())) == 2> t5;
56 sa<sizeof(sink_1_2(c_source())) == 2> t6;
60 three sink_1_3(volatile A&);
67 const volatile A cva = a;
68 sa<sizeof(sink_1_3(a)) == 3> t1;
69 sa<sizeof(sink_1_3(va)) == 3> t3;
73 four sink_1_4(const volatile A&);
80 const volatile A cva = a;
81 sa<sizeof(sink_1_4(a)) == 4> t1;
82 sa<sizeof(sink_1_4(ca)) == 4> t2;
83 sa<sizeof(sink_1_4(va)) == 4> t3;
84 sa<sizeof(sink_1_4(cva)) == 4> t4;
95 const volatile A cva = a;
96 sa<sizeof(sink_1_5(source())) == 5> t5;
100 six sink_1_6(const A&&);
107 const volatile A cva = a;
108 sa<sizeof(sink_1_6(source())) == 6> t5;
109 sa<sizeof(sink_1_6(c_source())) == 6> t6;
113 seven sink_1_7(volatile A&&);
120 const volatile A cva = a;
121 sa<sizeof(sink_1_7(source())) == 7> t5;
122 sa<sizeof(sink_1_7(v_source())) == 7> t7;
126 eight sink_1_8(const volatile A&&);
133 const volatile A cva = a;
134 sa<sizeof(sink_1_8(source())) == 8> t5;
135 sa<sizeof(sink_1_8(c_source())) == 8> t6;
136 sa<sizeof(sink_1_8(v_source())) == 8> t7;
137 sa<sizeof(sink_1_8(cv_source())) == 8> t8;
143 return test1_1() + test1_2() + test1_3() + test1_4() +
144 test1_5() + test1_6() + test1_7() + test1_8();