OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [rv1n.C] - Blame information for rev 693

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// I, Howard Hinnant, hereby place this code in the public domain.
2
 
3
// Test overload resolution among reference types
4
 
5
// { dg-do compile }
6
// { dg-options "-std=c++0x" }
7
 
8
template  struct sa;
9
template <> struct sa {};
10
 
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];};
19
 
20
struct A
21
{
22
    A();
23
    A(const volatile A&&);
24
};
25
 
26
               A    source();
27
const          A  c_source();
28
      volatile A  v_source();
29
const volatile A cv_source();
30
 
31
// 1 at a time
32
 
33
one   sink_1_1(               A&);  // { dg-error "" }
34
 
35
int test1_1()
36
{
37
                   A a;
38
    const          A ca = a;    // { dg-error "deleted" }
39
          volatile A va;
40
    const volatile A cva = a;   // { dg-error "deleted" }
41
    sink_1_1(ca);           // { dg-error "invalid initialization" }
42
    sink_1_1(va);           // { dg-error "invalid initialization" }
43
    sink_1_1(cva);          // { dg-error "invalid initialization" }
44
    sink_1_1(source());     // { dg-error "invalid initialization" }
45
    sink_1_1(c_source());   // { dg-error "invalid initialization" }
46
    sink_1_1(v_source());   // { dg-error "invalid initialization" }
47
    sink_1_1(cv_source());  // { dg-error "invalid initialization" }
48
    return 0;
49
}
50
 
51
two   sink_1_2(const          A&);  // { dg-error "" }
52
 
53
int test1_2()
54
{
55
                   A a;
56
    const          A ca = a; // { dg-error "deleted" }
57
          volatile A va;
58
    const volatile A cva = a; // { dg-error "deleted" }
59
    sink_1_2(va);           // { dg-error "invalid initialization" }
60
    sink_1_2(cva);          // { dg-error "invalid initialization" }
61
    sink_1_2(v_source());   // { dg-error "invalid initialization" }
62
    sink_1_2(cv_source());  // { dg-error "invalid initialization" }
63
    return 0;
64
}
65
 
66
three sink_1_3(volatile       A&);  // { dg-error "" }
67
 
68
int test1_3()
69
{
70
                   A a;
71
    const          A ca = a; // { dg-error "deleted" }
72
          volatile A va;
73
    const volatile A cva = a; // { dg-error "deleted" }
74
    sink_1_3(ca);           // { dg-error "invalid initialization" }
75
    sink_1_3(cva);          // { dg-error "invalid initialization" }
76
    sink_1_3(source());     // { dg-error "invalid initialization" }
77
    sink_1_3(c_source());   // { dg-error "invalid initialization" }
78
    sink_1_3(v_source());   // { dg-error "invalid initialization" }
79
    sink_1_3(cv_source());  // { dg-error "invalid initialization" }
80
    return 0;
81
}
82
 
83
four  sink_1_4(const volatile A&);  // { dg-error "" }
84
 
85
int test1_4()
86
{
87
                   A a;
88
    const          A ca = a; // { dg-error "deleted" }
89
          volatile A va;
90
    const volatile A cva = a; // { dg-error "deleted" }
91
    sink_1_4(source());     // { dg-error "invalid initialization" }
92
    sink_1_4(c_source());   // { dg-error "invalid initialization" }
93
    sink_1_4(v_source());   // { dg-error "invalid initialization" }
94
    sink_1_4(cv_source());  // { dg-error "invalid initialization" }
95
    return 0;
96
}
97
 
98
five  sink_1_5(               A&&);  // { dg-error "" }
99
 
100
int test1_5()
101
{
102
                   A a;
103
    const          A ca = a; // { dg-error "deleted" }
104
          volatile A va;
105
    const volatile A cva = a; // { dg-error "deleted" }
106
    sink_1_5(a);                // { dg-error "lvalue" }
107
    sink_1_5(ca);           // { dg-error "invalid initialization" }
108
    sink_1_5(va);           // { dg-error "invalid initialization" }
109
    sink_1_5(cva);          // { dg-error "invalid initialization" }
110
    sink_1_5(c_source());   // { dg-error "invalid initialization" }
111
    sink_1_5(v_source());   // { dg-error "invalid initialization" }
112
    sink_1_5(cv_source());  // { dg-error "invalid initialization" }
113
    return 0;
114
}
115
 
116
six   sink_1_6(const          A&&);  // { dg-error "" }
117
 
118
int test1_6()
119
{
120
                   A a;
121
    const          A ca = a; // { dg-error "deleted" }
122
          volatile A va;
123
    const volatile A cva = a; // { dg-error "deleted" }
124
    sink_1_6(a);                // { dg-error "lvalue" }
125
    sink_1_6(ca);               // { dg-error "lvalue" }
126
    sink_1_6(va);           // { dg-error "invalid initialization" }
127
    sink_1_6(cva);          // { dg-error "invalid initialization" }
128
    sink_1_6(v_source());   // { dg-error "invalid initialization" }
129
    sink_1_6(cv_source());  // { dg-error "invalid initialization" }
130
    return 0;
131
}
132
 
133
seven sink_1_7(volatile       A&&);  // { dg-error "" }
134
 
135
int test1_7()
136
{
137
                   A a;
138
    const          A ca = a; // { dg-error "deleted" }
139
          volatile A va;
140
    const volatile A cva = a; // { dg-error "deleted" }
141
    sink_1_7(a);            // { dg-error "lvalue" }
142
    sink_1_7(ca);           // { dg-error "invalid initialization" }
143
    sink_1_7(va);           // { dg-error "lvalue" }
144
    sink_1_7(cva);          // { dg-error "invalid initialization" }
145
    sink_1_7(c_source());   // { dg-error "invalid initialization" }
146
    sink_1_7(cv_source());  // { dg-error "invalid initialization" }
147
    return 0;
148
}
149
 
150
eight sink_1_8(const volatile A&&); // { dg-error "" }
151
 
152
int test1_8()
153
{
154
                   A a;
155
    const          A ca = a; // { dg-error "deleted" }
156
          volatile A va;
157
    const volatile A cva = a; // { dg-error "deleted" }
158
    sink_1_8(a);                // { dg-error "lvalue" }
159
    sink_1_8(ca);               // { dg-error "lvalue" }
160
    sink_1_8(va);               // { dg-error "lvalue" }
161
    sink_1_8(cva);              // { dg-error "lvalue" }
162
    return 0;
163
}
164
 
165
int main()
166
{
167
    return test1_1() + test1_2() + test1_3() + test1_5() +
168
           test1_6() + test1_7();
169
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.