Merged trunk at revision 161680 into branch.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / rv8p.C
blob8ee993854b8d3e8e53ac1ffd5fadb688314fc742
1 // I, Howard Hinnant, hereby place this code in the public domain.
3 // Test overload resolution among reference types
5 // { dg-do compile }
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];};
20 struct A
22     A();
23     A(const volatile A&&);
26                A    source();
27 const          A  c_source();
28       volatile A  v_source();
29 const volatile A cv_source();
31 // 8 at a time
33 one   sink_8_12345678(               A&);
34 two   sink_8_12345678(const          A&);
35 three sink_8_12345678(volatile       A&);
36 four  sink_8_12345678(const volatile A&);
37 five  sink_8_12345678(               A&&);
38 six   sink_8_12345678(const          A&&);
39 seven sink_8_12345678(volatile       A&&);
40 eight sink_8_12345678(const volatile A&&);
42 int test8_12345678()
44                    A a;
45     const          A ca;
46           volatile A va;
47     const volatile A cva;
48     sa<sizeof(sink_8_12345678(a))           == 1> t1;
49     sa<sizeof(sink_8_12345678(ca))          == 2> t2;
50     sa<sizeof(sink_8_12345678(va))          == 3> t3;
51     sa<sizeof(sink_8_12345678(cva))         == 4> t4;
52     sa<sizeof(sink_8_12345678(source()))    == 5> t5;
53     sa<sizeof(sink_8_12345678(c_source()))  == 6> t6;
54     sa<sizeof(sink_8_12345678(v_source()))  == 7> t7;
55     sa<sizeof(sink_8_12345678(cv_source())) == 8> t8;
56     return 0;
59 int main()
61     return test8_12345678();