Debian Codegraph @

gcc/testsuite/g++.dg/cpp23/explicit-obj-redecl.C

raw
1 // P0847R7
2 // { dg-do compile { target c++23 } }
3
4 // redeclarations of xobj/iobj member functions where the iobj member function
5 // is not ref qualified
6
7 // it does not make sense to check for the inverse in this test (7 iobj, 1 xobj)
8 // because you are not allowed to overload iobj member functions without ref qualifiers
9 // with iobj member functions that do (and vice versa)
10
11 // iobj first
12
13 struct S0 {
14 void f0(); // { dg-note "previous declaration" }
15 void f0(this S0 &&); // { dg-error "cannot be overloaded with" }
16 void f0(this S0 const&); // { dg-bogus "" }
17 void f0(this S0 const&&); // { dg-bogus "" }
18 void f0(this S0 volatile&); // { dg-bogus "" }
19 void f0(this S0 volatile&&); // { dg-bogus "" }
20 void f0(this S0 const volatile&); // { dg-bogus "" }
21 void f0(this S0 const volatile&&); // { dg-bogus "" }
22
23 void f1(); // { dg-note "previous declaration" }
24 void f1(this S0 &); // { dg-error "cannot be overloaded with" }
25 void f1(this S0 const&); // { dg-bogus "" }
26 void f1(this S0 const&&); // { dg-bogus "" }
27 void f1(this S0 volatile&); // { dg-bogus "" }
28 void f1(this S0 volatile&&); // { dg-bogus "" }
29 void f1(this S0 const volatile&); // { dg-bogus "" }
30 void f1(this S0 const volatile&&); // { dg-bogus "" }
31
32 void fc0() const; // { dg-note "previous declaration" }
33 void fc0(this S0 &); // { dg-bogus "" }
34 void fc0(this S0 &&); // { dg-bogus "" }
35 void fc0(this S0 const&&); // { dg-error "cannot be overloaded with" }
36 void fc0(this S0 volatile&); // { dg-bogus "" }
37 void fc0(this S0 volatile&&); // { dg-bogus "" }
38 void fc0(this S0 const volatile&); // { dg-bogus "" }
39 void fc0(this S0 const volatile&&); // { dg-bogus "" }
40
41 void fc1() const; // { dg-note "previous declaration" }
42 void fc1(this S0 &); // { dg-bogus "" }
43 void fc1(this S0 &&); // { dg-bogus "" }
44 void fc1(this S0 const&); // { dg-error "cannot be overloaded with" }
45 void fc1(this S0 volatile&); // { dg-bogus "" }
46 void fc1(this S0 volatile&&); // { dg-bogus "" }
47 void fc1(this S0 const volatile&); // { dg-bogus "" }
48 void fc1(this S0 const volatile&&); // { dg-bogus "" }
49
50 void fv0() volatile; // { dg-note "previous declaration" }
51 void fv0(this S0 &); // { dg-bogus "" }
52 void fv0(this S0 &&); // { dg-bogus "" }
53 void fv0(this S0 const&); // { dg-bogus "" }
54 void fv0(this S0 const&&); // { dg-bogus "" }
55 void fv0(this S0 volatile&&); // { dg-error "cannot be overloaded with" }
56 void fv0(this S0 const volatile&); // { dg-bogus "" }
57 void fv0(this S0 const volatile&&); // { dg-bogus "" }
58
59 void fv1() volatile; // { dg-note "previous declaration" }
60 void fv1(this S0 &); // { dg-bogus "" }
61 void fv1(this S0 &&); // { dg-bogus "" }
62 void fv1(this S0 const&); // { dg-bogus "" }
63 void fv1(this S0 const&&); // { dg-bogus "" }
64 void fv1(this S0 volatile&); // { dg-error "cannot be overloaded with" }
65 void fv1(this S0 const volatile&); // { dg-bogus "" }
66 void fv1(this S0 const volatile&&); // { dg-bogus "" }
67
68 void fcv0() const volatile; // { dg-note "previous declaration" }
69 void fcv0(this S0 &); // { dg-bogus "" }
70 void fcv0(this S0 &&); // { dg-bogus "" }
71 void fcv0(this S0 const&); // { dg-bogus "" }
72 void fcv0(this S0 const&&); // { dg-bogus "" }
73 void fcv0(this S0 volatile&); // { dg-bogus "" }
74 void fcv0(this S0 volatile&&); // { dg-bogus "" }
75 void fcv0(this S0 const volatile&&); // { dg-error "cannot be overloaded with" }
76
77 void fcv1() const volatile; // { dg-note "previous declaration" }
78 void fcv1(this S0 &); // { dg-bogus "" }
79 void fcv1(this S0 &&); // { dg-bogus "" }
80 void fcv1(this S0 const&); // { dg-bogus "" }
81 void fcv1(this S0 const&&); // { dg-bogus "" }
82 void fcv1(this S0 volatile&); // { dg-bogus "" }
83 void fcv1(this S0 volatile&&); // { dg-bogus "" }
84 void fcv1(this S0 const volatile&); // { dg-error "cannot be overloaded with" }
85 };
86
87 // iobj last
88
89 struct S1 {
90 void f0(this S1 &&); // { dg-note "previous declaration" }
91 void f0(this S1 const&); // { dg-bogus "" }
92 void f0(this S1 const&&); // { dg-bogus "" }
93 void f0(this S1 volatile&); // { dg-bogus "" }
94 void f0(this S1 volatile&&); // { dg-bogus "" }
95 void f0(this S1 const volatile&); // { dg-bogus "" }
96 void f0(this S1 const volatile&&); // { dg-bogus "" }
97 void f0(); // { dg-error "cannot be overloaded with" }
98
99 void f1(this S1 &); // { dg-note "previous declaration" }
100 void f1(this S1 const&); // { dg-bogus "" }
101 void f1(this S1 const&&); // { dg-bogus "" }
102 void f1(this S1 volatile&); // { dg-bogus "" }
103 void f1(this S1 volatile&&); // { dg-bogus "" }
104 void f1(this S1 const volatile&); // { dg-bogus "" }
105 void f1(this S1 const volatile&&); // { dg-bogus "" }
106 void f1(); // { dg-error "cannot be overloaded with" }
107
108 void fc0(this S1 &); // { dg-bogus "" }
109 void fc0(this S1 &&); // { dg-bogus "" }
110 void fc0(this S1 const&&); // { dg-note "previous declaration" }
111 void fc0(this S1 volatile&); // { dg-bogus "" }
112 void fc0(this S1 volatile&&); // { dg-bogus "" }
113 void fc0(this S1 const volatile&); // { dg-bogus "" }
114 void fc0(this S1 const volatile&&); // { dg-bogus "" }
115 void fc0() const; // { dg-error "cannot be overloaded with" }
116
117 void fc1(this S1 &); // { dg-bogus "" }
118 void fc1(this S1 &&); // { dg-bogus "" }
119 void fc1(this S1 const&); // { dg-note "previous declaration" }
120 void fc1(this S1 volatile&); // { dg-bogus "" }
121 void fc1(this S1 volatile&&); // { dg-bogus "" }
122 void fc1(this S1 const volatile&); // { dg-bogus "" }
123 void fc1(this S1 const volatile&&); // { dg-bogus "" }
124 void fc1() const; // { dg-error "cannot be overloaded with" }
125
126 void fv0(this S1 &); // { dg-bogus "" }
127 void fv0(this S1 &&); // { dg-bogus "" }
128 void fv0(this S1 const&); // { dg-bogus "" }
129 void fv0(this S1 const&&); // { dg-bogus "" }
130 void fv0(this S1 volatile&&); // { dg-note "previous declaration" }
131 void fv0(this S1 const volatile&); // { dg-bogus "" }
132 void fv0(this S1 const volatile&&); // { dg-bogus "" }
133 void fv0() volatile; // { dg-error "cannot be overloaded with" }
134
135 void fv1(this S1 &); // { dg-bogus "" }
136 void fv1(this S1 &&); // { dg-bogus "" }
137 void fv1(this S1 const&); // { dg-bogus "" }
138 void fv1(this S1 const&&); // { dg-bogus "" }
139 void fv1(this S1 volatile&); // { dg-note "previous declaration" }
140 void fv1(this S1 const volatile&); // { dg-bogus "" }
141 void fv1(this S1 const volatile&&); // { dg-bogus "" }
142 void fv1() volatile; // { dg-error "cannot be overloaded with" }
143
144 void fcv0(this S1 &); // { dg-bogus "" }
145 void fcv0(this S1 &&); // { dg-bogus "" }
146 void fcv0(this S1 const&); // { dg-bogus "" }
147 void fcv0(this S1 const&&); // { dg-bogus "" }
148 void fcv0(this S1 volatile&); // { dg-bogus "" }
149 void fcv0(this S1 volatile&&); // { dg-bogus "" }
150 void fcv0(this S1 const volatile&&); // { dg-note "previous declaration" }
151 void fcv0() const volatile; // { dg-error "cannot be overloaded with" }
152
153 void fcv1(this S1 &); // { dg-bogus "" }
154 void fcv1(this S1 &&); // { dg-bogus "" }
155 void fcv1(this S1 const&); // { dg-bogus "" }
156 void fcv1(this S1 const&&); // { dg-bogus "" }
157 void fcv1(this S1 volatile&); // { dg-bogus "" }
158 void fcv1(this S1 volatile&&); // { dg-bogus "" }
159 void fcv1(this S1 const volatile&); // { dg-note "previous declaration" }
160 void fcv1() const volatile; // { dg-error "cannot be overloaded with" }
161 };
162
163 // in order (iobj replacing one of the following in each group)
164 // lvalue ref to S
165 // rvalue ref to S
166 // lvalue c ref to S
167 // rvalue c ref to S
168 // lvalue v ref to S
169 // rvalue v ref to S
170 // lvalue cv ref to S
171 // rvalue cv ref to S
172
173 struct S2 {
174 void f0(); // { dg-note "previous declaration" }
175 void f0(this S2 &&); // { dg-error "cannot be overloaded with" }
176 void f0(this S2 const&); // { dg-bogus "" }
177 void f0(this S2 const&&); // { dg-bogus "" }
178 void f0(this S2 volatile&); // { dg-bogus "" }
179 void f0(this S2 volatile&&); // { dg-bogus "" }
180 void f0(this S2 const volatile&); // { dg-bogus "" }
181 void f0(this S2 const volatile&&); // { dg-bogus "" }
182
183 void f1(this S2 &); // { dg-note "previous declaration" }
184 void f1(); // { dg-error "cannot be overloaded with" }
185 void f1(this S2 const&); // { dg-bogus "" }
186 void f1(this S2 const&&); // { dg-bogus "" }
187 void f1(this S2 volatile&); // { dg-bogus "" }
188 void f1(this S2 volatile&&); // { dg-bogus "" }
189 void f1(this S2 const volatile&); // { dg-bogus "" }
190 void f1(this S2 const volatile&&); // { dg-bogus "" }
191
192 void fc0(this S2 &); // { dg-bogus "" }
193 void fc0(this S2 &&); // { dg-bogus "" }
194 void fc0() const; // { dg-note "previous declaration" }
195 void fc0(this S2 const&&); // { dg-error "cannot be overloaded with" }
196 void fc0(this S2 volatile&); // { dg-bogus "" }
197 void fc0(this S2 volatile&&); // { dg-bogus "" }
198 void fc0(this S2 const volatile&); // { dg-bogus "" }
199 void fc0(this S2 const volatile&&); // { dg-bogus "" }
200
201 void fc1(this S2 &); // { dg-bogus "" }
202 void fc1(this S2 &&); // { dg-bogus "" }
203 void fc1(this S2 const&); // { dg-note "previous declaration" }
204 void fc1() const; // { dg-error "cannot be overloaded with" }
205 void fc1(this S2 volatile&); // { dg-bogus "" }
206 void fc1(this S2 volatile&&); // { dg-bogus "" }
207 void fc1(this S2 const volatile&); // { dg-bogus "" }
208 void fc1(this S2 const volatile&&); // { dg-bogus "" }
209
210 void fv0(this S2 &); // { dg-bogus "" }
211 void fv0(this S2 &&); // { dg-bogus "" }
212 void fv0(this S2 const&); // { dg-bogus "" }
213 void fv0(this S2 const&&); // { dg-bogus "" }
214 void fv0() volatile; // { dg-note "previous declaration" }
215 void fv0(this S2 volatile&&); // { dg-error "cannot be overloaded with" }
216 void fv0(this S2 const volatile&); // { dg-bogus "" }
217 void fv0(this S2 const volatile&&); // { dg-bogus "" }
218
219 void fv1(this S2 &); // { dg-bogus "" }
220 void fv1(this S2 &&); // { dg-bogus "" }
221 void fv1(this S2 const&); // { dg-bogus "" }
222 void fv1(this S2 const&&); // { dg-bogus "" }
223 void fv1(this S2 volatile&); // { dg-note "previous declaration" }
224 void fv1() volatile; // { dg-error "cannot be overloaded with" }
225 void fv1(this S2 const volatile&); // { dg-bogus "" }
226 void fv1(this S2 const volatile&&); // { dg-bogus "" }
227
228 void fcv0(this S2 &); // { dg-bogus "" }
229 void fcv0(this S2 &&); // { dg-bogus "" }
230 void fcv0(this S2 const&); // { dg-bogus "" }
231 void fcv0(this S2 const&&); // { dg-bogus "" }
232 void fcv0(this S2 volatile&); // { dg-bogus "" }
233 void fcv0(this S2 volatile&&); // { dg-bogus "" }
234 void fcv0() const volatile; // { dg-note "previous declaration" }
235 void fcv0(this S2 const volatile&&); // { dg-error "cannot be overloaded with" }
236
237 void fcv1(this S2 &); // { dg-bogus "" }
238 void fcv1(this S2 &&); // { dg-bogus "" }
239 void fcv1(this S2 const&); // { dg-bogus "" }
240 void fcv1(this S2 const&&); // { dg-bogus "" }
241 void fcv1(this S2 volatile&); // { dg-bogus "" }
242 void fcv1(this S2 volatile&&); // { dg-bogus "" }
243 void fcv1(this S2 const volatile&); // { dg-note "previous declaration" }
244 void fcv1() const volatile; // { dg-error "cannot be overloaded with" }
245 };
246