aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp23/explicit-obj-redecl.C
blob: 7fcfcc31c301b107ebdb4cc09f1ddcf4efeb921e (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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
// P0847R7
// { dg-do compile { target c++23 } }

// redeclarations of xobj/iobj member functions where the iobj member function
// is not ref qualified

// it does not make sense to check for the inverse in this test (7 iobj, 1 xobj)
// because you are not allowed to overload iobj member functions without ref qualifiers
// with iobj member functions that do (and vice versa)

// iobj first

struct S0 {
  void f0(); // { dg-note "previous declaration" }
  void f0(this S0 &&); // { dg-error "cannot be overloaded with" }
  void f0(this S0 const&); // { dg-bogus "" }
  void f0(this S0 const&&); // { dg-bogus "" }
  void f0(this S0 volatile&); // { dg-bogus "" }
  void f0(this S0 volatile&&); // { dg-bogus "" }
  void f0(this S0 const volatile&); // { dg-bogus "" }
  void f0(this S0 const volatile&&); // { dg-bogus "" }

  void f1(); // { dg-note "previous declaration" }
  void f1(this S0 &); // { dg-error "cannot be overloaded with" }
  void f1(this S0 const&); // { dg-bogus "" }
  void f1(this S0 const&&); // { dg-bogus "" }
  void f1(this S0 volatile&); // { dg-bogus "" }
  void f1(this S0 volatile&&); // { dg-bogus "" }
  void f1(this S0 const volatile&); // { dg-bogus "" }
  void f1(this S0 const volatile&&); // { dg-bogus "" }

  void fc0() const; // { dg-note "previous declaration" }
  void fc0(this S0 &); // { dg-bogus "" }
  void fc0(this S0 &&); // { dg-bogus "" }
  void fc0(this S0 const&&); // { dg-error "cannot be overloaded with" }
  void fc0(this S0 volatile&); // { dg-bogus "" }
  void fc0(this S0 volatile&&); // { dg-bogus "" }
  void fc0(this S0 const volatile&); // { dg-bogus "" }
  void fc0(this S0 const volatile&&); // { dg-bogus "" }

  void fc1() const; // { dg-note "previous declaration" }
  void fc1(this S0 &); // { dg-bogus "" }
  void fc1(this S0 &&); // { dg-bogus "" }
  void fc1(this S0 const&); // { dg-error "cannot be overloaded with" }
  void fc1(this S0 volatile&); // { dg-bogus "" }
  void fc1(this S0 volatile&&); // { dg-bogus "" }
  void fc1(this S0 const volatile&); // { dg-bogus "" }
  void fc1(this S0 const volatile&&); // { dg-bogus "" }

  void fv0() volatile; // { dg-note "previous declaration" }
  void fv0(this S0 &); // { dg-bogus "" }
  void fv0(this S0 &&); // { dg-bogus "" }
  void fv0(this S0 const&); // { dg-bogus "" }
  void fv0(this S0 const&&); // { dg-bogus "" }
  void fv0(this S0 volatile&&); // { dg-error "cannot be overloaded with" }
  void fv0(this S0 const volatile&); // { dg-bogus "" }
  void fv0(this S0 const volatile&&); // { dg-bogus "" }

  void fv1() volatile; // { dg-note "previous declaration" }
  void fv1(this S0 &); // { dg-bogus "" }
  void fv1(this S0 &&); // { dg-bogus "" }
  void fv1(this S0 const&); // { dg-bogus "" }
  void fv1(this S0 const&&); // { dg-bogus "" }
  void fv1(this S0 volatile&); // { dg-error "cannot be overloaded with" }
  void fv1(this S0 const volatile&); // { dg-bogus "" }
  void fv1(this S0 const volatile&&); // { dg-bogus "" }

  void fcv0() const volatile; // { dg-note "previous declaration" }
  void fcv0(this S0 &); // { dg-bogus "" }
  void fcv0(this S0 &&); // { dg-bogus "" }
  void fcv0(this S0 const&); // { dg-bogus "" }
  void fcv0(this S0 const&&); // { dg-bogus "" }
  void fcv0(this S0 volatile&); // { dg-bogus "" }
  void fcv0(this S0 volatile&&); // { dg-bogus "" }
  void fcv0(this S0 const volatile&&); // { dg-error "cannot be overloaded with" }

  void fcv1() const volatile; // { dg-note "previous declaration" }
  void fcv1(this S0 &); // { dg-bogus "" }
  void fcv1(this S0 &&); // { dg-bogus "" }
  void fcv1(this S0 const&); // { dg-bogus "" }
  void fcv1(this S0 const&&); // { dg-bogus "" }
  void fcv1(this S0 volatile&); // { dg-bogus "" }
  void fcv1(this S0 volatile&&); // { dg-bogus "" }
  void fcv1(this S0 const volatile&); // { dg-error "cannot be overloaded with" }
};

// iobj last

struct S1 {
  void f0(this S1 &&); // { dg-note "previous declaration" }
  void f0(this S1 const&); // { dg-bogus "" }
  void f0(this S1 const&&); // { dg-bogus "" }
  void f0(this S1 volatile&); // { dg-bogus "" }
  void f0(this S1 volatile&&); // { dg-bogus "" }
  void f0(this S1 const volatile&); // { dg-bogus "" }
  void f0(this S1 const volatile&&); // { dg-bogus "" }
  void f0(); // { dg-error "cannot be overloaded with" }

  void f1(this S1 &); // { dg-note "previous declaration" }
  void f1(this S1 const&); // { dg-bogus "" }
  void f1(this S1 const&&); // { dg-bogus "" }
  void f1(this S1 volatile&); // { dg-bogus "" }
  void f1(this S1 volatile&&); // { dg-bogus "" }
  void f1(this S1 const volatile&); // { dg-bogus "" }
  void f1(this S1 const volatile&&); // { dg-bogus "" }
  void f1(); // { dg-error "cannot be overloaded with" }

  void fc0(this S1 &); // { dg-bogus "" }
  void fc0(this S1 &&); // { dg-bogus "" }
  void fc0(this S1 const&&); // { dg-note "previous declaration" }
  void fc0(this S1 volatile&); // { dg-bogus "" }
  void fc0(this S1 volatile&&); // { dg-bogus "" }
  void fc0(this S1 const volatile&); // { dg-bogus "" }
  void fc0(this S1 const volatile&&); // { dg-bogus "" }
  void fc0() const; // { dg-error "cannot be overloaded with" }

  void fc1(this S1 &); // { dg-bogus "" }
  void fc1(this S1 &&); // { dg-bogus "" }
  void fc1(this S1 const&); // { dg-note "previous declaration" }
  void fc1(this S1 volatile&); // { dg-bogus "" }
  void fc1(this S1 volatile&&); // { dg-bogus "" }
  void fc1(this S1 const volatile&); // { dg-bogus "" }
  void fc1(this S1 const volatile&&); // { dg-bogus "" }
  void fc1() const; // { dg-error "cannot be overloaded with" }

  void fv0(this S1 &); // { dg-bogus "" }
  void fv0(this S1 &&); // { dg-bogus "" }
  void fv0(this S1 const&); // { dg-bogus "" }
  void fv0(this S1 const&&); // { dg-bogus "" }
  void fv0(this S1 volatile&&); // { dg-note "previous declaration" }
  void fv0(this S1 const volatile&); // { dg-bogus "" }
  void fv0(this S1 const volatile&&); // { dg-bogus "" }
  void fv0() volatile; // { dg-error "cannot be overloaded with" }

  void fv1(this S1 &); // { dg-bogus "" }
  void fv1(this S1 &&); // { dg-bogus "" }
  void fv1(this S1 const&); // { dg-bogus "" }
  void fv1(this S1 const&&); // { dg-bogus "" }
  void fv1(this S1 volatile&); // { dg-note "previous declaration" }
  void fv1(this S1 const volatile&); // { dg-bogus "" }
  void fv1(this S1 const volatile&&); // { dg-bogus "" }
  void fv1() volatile; // { dg-error "cannot be overloaded with" }

  void fcv0(this S1 &); // { dg-bogus "" }
  void fcv0(this S1 &&); // { dg-bogus "" }
  void fcv0(this S1 const&); // { dg-bogus "" }
  void fcv0(this S1 const&&); // { dg-bogus "" }
  void fcv0(this S1 volatile&); // { dg-bogus "" }
  void fcv0(this S1 volatile&&); // { dg-bogus "" }
  void fcv0(this S1 const volatile&&); // { dg-note "previous declaration" }
  void fcv0() const volatile; // { dg-error "cannot be overloaded with" }

  void fcv1(this S1 &); // { dg-bogus "" }
  void fcv1(this S1 &&); // { dg-bogus "" }
  void fcv1(this S1 const&); // { dg-bogus "" }
  void fcv1(this S1 const&&); // { dg-bogus "" }
  void fcv1(this S1 volatile&); // { dg-bogus "" }
  void fcv1(this S1 volatile&&); // { dg-bogus "" }
  void fcv1(this S1 const volatile&); // { dg-note "previous declaration" }
  void fcv1() const volatile; // { dg-error "cannot be overloaded with" }
};

// in order (iobj replacing one of the following in each group)
// lvalue ref to S
// rvalue ref to S
// lvalue c ref to S
// rvalue c ref to S
// lvalue v ref to S
// rvalue v ref to S
// lvalue cv ref to S
// rvalue cv ref to S

struct S2 {
  void f0(); // { dg-note "previous declaration" }
  void f0(this S2 &&); // { dg-error "cannot be overloaded with" }
  void f0(this S2 const&); // { dg-bogus "" }
  void f0(this S2 const&&); // { dg-bogus "" }
  void f0(this S2 volatile&); // { dg-bogus "" }
  void f0(this S2 volatile&&); // { dg-bogus "" }
  void f0(this S2 const volatile&); // { dg-bogus "" }
  void f0(this S2 const volatile&&); // { dg-bogus "" }

  void f1(this S2 &); // { dg-note "previous declaration" }
  void f1(); // { dg-error "cannot be overloaded with" }
  void f1(this S2 const&); // { dg-bogus "" }
  void f1(this S2 const&&); // { dg-bogus "" }
  void f1(this S2 volatile&); // { dg-bogus "" }
  void f1(this S2 volatile&&); // { dg-bogus "" }
  void f1(this S2 const volatile&); // { dg-bogus "" }
  void f1(this S2 const volatile&&); // { dg-bogus "" }

  void fc0(this S2 &); // { dg-bogus "" }
  void fc0(this S2 &&); // { dg-bogus "" }
  void fc0() const; // { dg-note "previous declaration" }
  void fc0(this S2 const&&); // { dg-error "cannot be overloaded with" }
  void fc0(this S2 volatile&); // { dg-bogus "" }
  void fc0(this S2 volatile&&); // { dg-bogus "" }
  void fc0(this S2 const volatile&); // { dg-bogus "" }
  void fc0(this S2 const volatile&&); // { dg-bogus "" }

  void fc1(this S2 &); // { dg-bogus "" }
  void fc1(this S2 &&); // { dg-bogus "" }
  void fc1(this S2 const&); // { dg-note "previous declaration" }
  void fc1() const; // { dg-error "cannot be overloaded with" }
  void fc1(this S2 volatile&); // { dg-bogus "" }
  void fc1(this S2 volatile&&); // { dg-bogus "" }
  void fc1(this S2 const volatile&); // { dg-bogus "" }
  void fc1(this S2 const volatile&&); // { dg-bogus "" }

  void fv0(this S2 &); // { dg-bogus "" }
  void fv0(this S2 &&); // { dg-bogus "" }
  void fv0(this S2 const&); // { dg-bogus "" }
  void fv0(this S2 const&&); // { dg-bogus "" }
  void fv0() volatile; // { dg-note "previous declaration" }
  void fv0(this S2 volatile&&); // { dg-error "cannot be overloaded with" }
  void fv0(this S2 const volatile&); // { dg-bogus "" }
  void fv0(this S2 const volatile&&); // { dg-bogus "" }

  void fv1(this S2 &); // { dg-bogus "" }
  void fv1(this S2 &&); // { dg-bogus "" }
  void fv1(this S2 const&); // { dg-bogus "" }
  void fv1(this S2 const&&); // { dg-bogus "" }
  void fv1(this S2 volatile&); // { dg-note "previous declaration" }
  void fv1() volatile; // { dg-error "cannot be overloaded with" }
  void fv1(this S2 const volatile&); // { dg-bogus "" }
  void fv1(this S2 const volatile&&); // { dg-bogus "" }

  void fcv0(this S2 &); // { dg-bogus "" }
  void fcv0(this S2 &&); // { dg-bogus "" }
  void fcv0(this S2 const&); // { dg-bogus "" }
  void fcv0(this S2 const&&); // { dg-bogus "" }
  void fcv0(this S2 volatile&); // { dg-bogus "" }
  void fcv0(this S2 volatile&&); // { dg-bogus "" }
  void fcv0() const volatile; // { dg-note "previous declaration" }
  void fcv0(this S2 const volatile&&); // { dg-error "cannot be overloaded with" }

  void fcv1(this S2 &); // { dg-bogus "" }
  void fcv1(this S2 &&); // { dg-bogus "" }
  void fcv1(this S2 const&); // { dg-bogus "" }
  void fcv1(this S2 const&&); // { dg-bogus "" }
  void fcv1(this S2 volatile&); // { dg-bogus "" }
  void fcv1(this S2 volatile&&); // { dg-bogus "" }
  void fcv1(this S2 const volatile&); // { dg-note "previous declaration" }
  void fcv1() const volatile; // { dg-error "cannot be overloaded with" }
};