summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/rv7n.C
blob: 6071e0568133941de21d037200f1b4321a51fa6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// I, Howard Hinnant, hereby place this code in the public domain.

// Test overload resolution among reference types

// { dg-do compile }
// { dg-options "-std=c++0x" }

template <bool> struct sa;
template <> struct sa<true> {};

struct one   {char x[1];};
struct two   {char x[2];};
struct three {char x[3];};
struct four  {char x[4];};
struct five  {char x[5];};
struct six   {char x[6];};
struct seven {char x[7];};
struct eight {char x[8];};

struct A
{
    A();
    A(const volatile A&&);	// { dg-error "argument 1" }
};

               A    source();
const          A  c_source();
      volatile A  v_source();
const volatile A cv_source();

// 7 at a time

one   sink_7_1234567(               A&);  // { dg-message "one sink_7_1234567|no known conversion" }
two   sink_7_1234567(const          A&);  // { dg-message "note" }
three sink_7_1234567(volatile       A&);  // { dg-message "note" }
four  sink_7_1234567(const volatile A&);  // { dg-message "note" }
five  sink_7_1234567(               A&&);  // { dg-message "note" }
six   sink_7_1234567(const          A&&);  // { dg-message "note" }
seven sink_7_1234567(volatile       A&&);  // { dg-message "note" }

int test7_1234567()
{
                   A a;
    const          A ca = a; // { dg-error "lvalue" }
          volatile A va;
    const volatile A cva = a; // { dg-error "lvalue" }
    sink_7_1234567(cv_source());  // { dg-error "no match" }
    // { dg-message "candidate" "candidate note" { target *-*-* } 47 }
    return 0;
}

one   sink_7_1235678(               A&);
two   sink_7_1235678(const          A&);
three sink_7_1235678(volatile       A&);
five  sink_7_1235678(               A&&);
six   sink_7_1235678(const          A&&);
seven sink_7_1235678(volatile       A&&);
eight sink_7_1235678(const volatile A&&); // { dg-message "" }

int test7_1235678()
{
                   A a;
    const          A ca = a; // { dg-error "lvalue" }
          volatile A va;
    const volatile A cva = a; // { dg-error "lvalue" }
    sink_7_1235678(cva);	// { dg-error "lvalue" }
    return 0;
}

two   sink_7_2345678(const          A&);  // { dg-message "note" }
three sink_7_2345678(volatile       A&);  // { dg-message "note" }
four  sink_7_2345678(const volatile A&);  // { dg-message "note" }
five  sink_7_2345678(               A&&);  // { dg-message "note" }
six   sink_7_2345678(const          A&&);  // { dg-message "note" }
seven sink_7_2345678(volatile       A&&);  // { dg-message "note" }
eight sink_7_2345678(const volatile A&&);  // { dg-message "note" }

int test7_2345678()
{
                   A a;
    const          A ca = a; // { dg-error "lvalue" }
          volatile A va;
    const volatile A cva = a; // { dg-error "lvalue" }
    sink_7_2345678(a);  // { dg-error "ambiguous" }
    // { dg-message "candidate" "candidate note" { target *-*-* } 84 }
    return 0;
}

one   sink_7_1234678(               A&);
two   sink_7_1234678(const          A&);  // { dg-message "note" }
three sink_7_1234678(volatile       A&);
four  sink_7_1234678(const volatile A&);
six   sink_7_1234678(const          A&&);  // { dg-message "note" }
seven sink_7_1234678(volatile       A&&);  // { dg-message "note" }
eight sink_7_1234678(const volatile A&&);  // { dg-message "note" }

int test7_1234678()
{
                   A a;
    const          A ca = a; // { dg-error "lvalue" }
          volatile A va;
    const volatile A cva = a; // { dg-error "lvalue" }
    sink_7_1234678(source());  // { dg-error "ambiguous" }
    // { dg-message "candidate" "candidate note" { target *-*-* } 103 }
    return 0;
}

int main()
{
    return test7_2345678() + test7_1234678();
}