| 1 |
// RUN: rm -rf %t |
| 2 |
// RUN: mkdir %t |
| 3 |
// RUN: split-file --leading-lines %s %t |
| 4 |
// RUN: %clang_cc1 -std=c++20 -pedantic-errors -fexceptions -fcxx-exceptions %t/cwg1884_A.cppm -triple x86_64-unknown-unknown -emit-module-interface -o %t/cwg1884_A.pcm |
| 5 |
// RUN: %clang_cc1 -std=c++20 -verify=since-cxx20 -pedantic-errors -fexceptions -fcxx-exceptions -triple x86_64-unknown-unknown %t/cwg1884.cpp -fmodule-file=cwg1884_A=%t/cwg1884_A.pcm |
| 6 |
// RUN: %clang_cc1 -std=c++23 -pedantic-errors -fexceptions -fcxx-exceptions %t/cwg1884_A.cppm -triple x86_64-unknown-unknown -emit-module-interface -o %t/cwg1884_A.pcm |
| 7 |
// RUN: %clang_cc1 -std=c++23 -verify=since-cxx20 -pedantic-errors -fexceptions -fcxx-exceptions -triple x86_64-unknown-unknown %t/cwg1884.cpp -fmodule-file=cwg1884_A=%t/cwg1884_A.pcm |
| 8 |
// RUN: %clang_cc1 -std=c++2c -pedantic-errors -fexceptions -fcxx-exceptions %t/cwg1884_A.cppm -triple x86_64-unknown-unknown -emit-module-interface -o %t/cwg1884_A.pcm |
| 9 |
// RUN: %clang_cc1 -std=c++2c -verify=since-cxx20 -pedantic-errors -fexceptions -fcxx-exceptions -triple x86_64-unknown-unknown %t/cwg1884.cpp -fmodule-file=cwg1884_A=%t/cwg1884_A.pcm |
| 10 |
|
| 11 |
// cwg1884: partial |
| 12 |
// Cases b11, e11, g3, g4 are problematic, but we handle the other 101 cases fine. |
| 13 |
|
| 14 |
// _N4993_.[basic.link]/11: |
| 15 |
// For any two declarations of an entity E: |
| 16 |
// — If one declares E to be a variable or function, |
| 17 |
// the other shall declare E as one of the same type. |
| 18 |
// — If one declares E to be an enumerator, the other shall do so. |
| 19 |
// — If one declares E to be a namespace, the other shall do so. |
| 20 |
// — If one declares E to be a type, |
| 21 |
// the other shall declare E to be a type of the same kind (9.2.9.5). |
| 22 |
// — If one declares E to be a class template, |
| 23 |
// the other shall do so with the same kind and an equivalent template-head (13.7.7.2). |
| 24 |
// [Note 5 : The declarations can supply different default template arguments. — end note] |
| 25 |
// — If one declares E to be a function template or a (partial specialization of a) variable template, |
| 26 |
// the other shall declare E to be one with an equivalent template-head and type. |
| 27 |
// — If one declares E to be an alias template, |
| 28 |
// the other shall declare E to be one with an equivalent template-head and defining-type-id. |
| 29 |
// — If one declares E to be a concept, the other shall do so. |
| 30 |
// Types are compared after all adjustments of types (during which typedefs (9.2.4) are replaced by their definitions); |
| 31 |
// declarations for an array object can specify array types that differ by the presence or absence of a major array bound (9.3.4.5). |
| 32 |
// No diagnostic is required if neither declaration is reachable from the other. |
| 33 |
|
| 34 |
// The structure of the test is the following. First, module cwg1884_A |
| 35 |
// provides all (significant) kinds of entities, each named 'a' through 'h', and copies of them. |
| 36 |
// Then the .cpp file does MxN kind of testing, where it tests one kind of entity against every other kind. |
| 37 |
|
| 38 |
//--- cwg1884_A.cppm |
| 39 |
export module cwg1884_A; |
| 40 |
|
| 41 |
export { |
| 42 |
int a1; |
| 43 |
int a2; |
| 44 |
int a3; |
| 45 |
int a4; |
| 46 |
int a5; |
| 47 |
int a6; |
| 48 |
int a7; |
| 49 |
int a8; |
| 50 |
int a9; |
| 51 |
int a10; |
| 52 |
int a11; |
| 53 |
void b1(); |
| 54 |
void b2(); |
| 55 |
void b3(); |
| 56 |
void b4(); |
| 57 |
void b5(); |
| 58 |
void b6(); |
| 59 |
void b7(); |
| 60 |
void b8(); |
| 61 |
void b9(); |
| 62 |
void b10(); |
| 63 |
void b11(); |
| 64 |
enum E { |
| 65 |
c1, |
| 66 |
c2, |
| 67 |
c3, |
| 68 |
c4, |
| 69 |
c5, |
| 70 |
c6, |
| 71 |
c7, |
| 72 |
c8, |
| 73 |
c9, |
| 74 |
c10 |
| 75 |
}; |
| 76 |
namespace d1 {} |
| 77 |
namespace d2 {} |
| 78 |
namespace d3 {} |
| 79 |
namespace d4 {} |
| 80 |
namespace d5 {} |
| 81 |
namespace d6 {} |
| 82 |
namespace d7 {} |
| 83 |
namespace d8 {} |
| 84 |
namespace d9 {} |
| 85 |
namespace d10 {} |
| 86 |
struct e1; |
| 87 |
struct e2; |
| 88 |
struct e3; |
| 89 |
struct e4; |
| 90 |
struct e5; |
| 91 |
struct e6; |
| 92 |
struct e7; |
| 93 |
struct e8; |
| 94 |
struct e9; |
| 95 |
struct e10; |
| 96 |
struct e11; |
| 97 |
struct e12; |
| 98 |
struct e13; |
| 99 |
template <typename> |
| 100 |
class f1; |
| 101 |
template <typename> |
| 102 |
class f2; |
| 103 |
template <typename> |
| 104 |
class f3; |
| 105 |
template <typename> |
| 106 |
class f4; |
| 107 |
template <typename> |
| 108 |
class f5; |
| 109 |
template <typename> |
| 110 |
class f6; |
| 111 |
template <typename> |
| 112 |
class f7; |
| 113 |
template <typename> |
| 114 |
class f8; |
| 115 |
template <typename> |
| 116 |
class f9; |
| 117 |
template <typename> |
| 118 |
class f10; |
| 119 |
template <typename> |
| 120 |
class f11; |
| 121 |
template <typename> |
| 122 |
void g1(int); |
| 123 |
template <typename> |
| 124 |
void g2(int); |
| 125 |
template <typename> |
| 126 |
void g3(int); |
| 127 |
template <typename> |
| 128 |
void g4(int); |
| 129 |
template <typename> |
| 130 |
void g5(int); |
| 131 |
template <typename> |
| 132 |
void g6(int); |
| 133 |
template <typename> |
| 134 |
void g7(int); |
| 135 |
template <typename> |
| 136 |
void g8(int); |
| 137 |
template <typename> |
| 138 |
void g9(int); |
| 139 |
template <typename> |
| 140 |
void g10(int); |
| 141 |
template <typename, typename> |
| 142 |
int h1; |
| 143 |
template <typename, typename> |
| 144 |
int h2; |
| 145 |
template <typename, typename> |
| 146 |
int h3; |
| 147 |
template <typename, typename> |
| 148 |
int h4; |
| 149 |
template <typename, typename> |
| 150 |
int h5; |
| 151 |
template <typename, typename> |
| 152 |
int h6; |
| 153 |
template <typename, typename> |
| 154 |
int h7; |
| 155 |
template <typename, typename> |
| 156 |
int h8; |
| 157 |
template <typename, typename> |
| 158 |
int h9; |
| 159 |
template <typename, typename> |
| 160 |
int h10; |
| 161 |
template <typename> |
| 162 |
using i1 = int; |
| 163 |
template <typename> |
| 164 |
using i2 = int; |
| 165 |
template <typename> |
| 166 |
using i3 = int; |
| 167 |
template <typename> |
| 168 |
using i4 = int; |
| 169 |
template <typename> |
| 170 |
using i5 = int; |
| 171 |
template <typename> |
| 172 |
using i6 = int; |
| 173 |
template <typename> |
| 174 |
using i7 = int; |
| 175 |
template <typename> |
| 176 |
using i8 = int; |
| 177 |
template <typename> |
| 178 |
using i9 = int; |
| 179 |
template <typename> |
| 180 |
using i10 = int; |
| 181 |
template <typename> |
| 182 |
using i11 = int; |
| 183 |
template <typename> |
| 184 |
concept j1 = true; |
| 185 |
template <typename> |
| 186 |
concept j2 = true; |
| 187 |
template <typename> |
| 188 |
concept j3 = true; |
| 189 |
template <typename> |
| 190 |
concept j4 = true; |
| 191 |
template <typename> |
| 192 |
concept j5 = true; |
| 193 |
template <typename> |
| 194 |
concept j6 = true; |
| 195 |
template <typename> |
| 196 |
concept j7 = true; |
| 197 |
template <typename> |
| 198 |
concept j8 = true; |
| 199 |
template <typename> |
| 200 |
concept j9 = true; |
| 201 |
template <typename> |
| 202 |
concept j10 = true; |
| 203 |
template <typename> |
| 204 |
concept j11 = true; |
| 205 |
} // export |
| 206 |
|
| 207 |
|
| 208 |
//--- cwg1884.cpp |
| 209 |
import cwg1884_A; |
| 210 |
|
| 211 |
// FIXME: we don't diagnose several cases we should be. They are marked with MISSING prefix. |
| 212 |
|
| 213 |
// Part A: matching against `int a;` |
| 214 |
// --------------------------------- |
| 215 |
|
| 216 |
void a1(); |
| 217 |
// since-cxx20-error@-1 {{redefinition of 'a1' as different kind of symbol}} |
| 218 |
// since-cxx20-note@cwg1884_A.cppm:42 {{previous definition is here}} |
| 219 |
enum Ea { |
| 220 |
a2 |
| 221 |
// since-cxx20-error@-1 {{redefinition of 'a2'}} |
| 222 |
// since-cxx20-note@cwg1884_A.cppm:43 {{previous definition is here}} |
| 223 |
}; |
| 224 |
namespace a3 {} |
| 225 |
// since-cxx20-error@-1 {{redefinition of 'a3' as different kind of symbol}} |
| 226 |
// since-cxx20-note@cwg1884_A.cppm:44 {{previous definition is here}} |
| 227 |
struct a4; |
| 228 |
// @-1 OK, types and variables do not correspond |
| 229 |
template <typename> |
| 230 |
class a5; |
| 231 |
// since-cxx20-error@-1 {{redefinition of 'a5' as different kind of symbol}} |
| 232 |
// since-cxx20-note@cwg1884_A.cppm:46 {{previous definition is here}} |
| 233 |
template <typename> |
| 234 |
void a6(int); |
| 235 |
// since-cxx20-error@-1 {{redefinition of 'a6' as different kind of symbol}} |
| 236 |
// since-cxx20-note@cwg1884_A.cppm:47 {{previous definition is here}} |
| 237 |
template <typename, typename> |
| 238 |
int a7; |
| 239 |
// since-cxx20-error@-1 {{redefinition of 'a7' as different kind of symbol}} |
| 240 |
// since-cxx20-note@cwg1884_A.cppm:48 {{previous definition is here}} |
| 241 |
template <typename T> |
| 242 |
int a8<T, int>; |
| 243 |
// since-cxx20-error@-1 {{redefinition of 'a8' as different kind of symbol}} |
| 244 |
// since-cxx20-note@cwg1884_A.cppm:49 {{previous definition is here}} |
| 245 |
// since-cxx20-error@-3 {{expected ';' after top level declarator}} |
| 246 |
template <typename> |
| 247 |
using a9 = int; |
| 248 |
// since-cxx20-error@-1 {{redefinition of 'a9' as different kind of symbol}} |
| 249 |
// since-cxx20-note@cwg1884_A.cppm:50 {{previous definition is here}} |
| 250 |
template <typename> |
| 251 |
concept a10 = true; |
| 252 |
// since-cxx20-error@-1 {{redefinition of 'a10' as different kind of symbol}} |
| 253 |
// since-cxx20-note@cwg1884_A.cppm:51 {{previous definition is here}} |
| 254 |
// For variables, type has to match as well. |
| 255 |
long a11; |
| 256 |
// since-cxx20-error@-1 {{redefinition of 'a11' with a different type: 'long' vs 'int'}} |
| 257 |
// since-cxx20-note@cwg1884_A.cppm:52 {{previous definition is here}} |
| 258 |
|
| 259 |
|
| 260 |
// Part B: matching against `void b();` |
| 261 |
// ------------------------------------ |
| 262 |
|
| 263 |
int b1; |
| 264 |
// since-cxx20-error@-1 {{redefinition of 'b1' as different kind of symbol}} |
| 265 |
// since-cxx20-note@cwg1884_A.cppm:53 {{previous definition is here}} |
| 266 |
enum Eb { |
| 267 |
b2 |
| 268 |
// since-cxx20-error@-1 {{redefinition of 'b2'}} |
| 269 |
// since-cxx20-note@cwg1884_A.cppm:54 {{previous definition is here}} |
| 270 |
}; |
| 271 |
namespace b3 {} // #cwg1884-namespace-b |
| 272 |
// since-cxx20-error@-1 {{redefinition of 'b3' as different kind of symbol}} |
| 273 |
// since-cxx20-note@cwg1884_A.cppm:55 {{previous definition is here}} |
| 274 |
struct b4; |
| 275 |
// @-1 OK, types and functions do not correspond |
| 276 |
template <typename> |
| 277 |
class b5; |
| 278 |
// since-cxx20-error@-1 {{redefinition of 'b5' as different kind of symbol}} |
| 279 |
// since-cxx20-note@cwg1884_A.cppm:57 {{previous definition is here}} |
| 280 |
template <typename> |
| 281 |
void b6(int); |
| 282 |
// @-1 OK, a non-corresponding overload |
| 283 |
template <typename, typename> |
| 284 |
int b7; |
| 285 |
// since-cxx20-error@-1 {{redefinition of 'b7' as different kind of symbol}} |
| 286 |
// since-cxx20-note@cwg1884_A.cppm:59 {{previous definition is here}} |
| 287 |
template <typename T> |
| 288 |
int b8<T, int>; |
| 289 |
// since-cxx20-error@-1 {{no variable template matches partial specialization}} |
| 290 |
template <typename> |
| 291 |
using b9 = int; |
| 292 |
// since-cxx20-error@-1 {{redefinition of 'b9' as different kind of symbol}} |
| 293 |
// since-cxx20-note@cwg1884_A.cppm:61 {{previous definition is here}} |
| 294 |
template <typename> |
| 295 |
concept b10 = true; |
| 296 |
// since-cxx20-error@-1 {{redefinition of 'b10' as different kind of symbol}} |
| 297 |
// since-cxx20-note@cwg1884_A.cppm:62 {{previous definition is here}} |
| 298 |
// For functions, type has to match as well. |
| 299 |
// FIXME: we should be loud and clear here about type mismatch, like we do in `a11` case. |
| 300 |
int b11(); |
| 301 |
// since-cxx20-error@-1 {{declaration of 'b11' in the global module follows declaration in module cwg1884_A}} |
| 302 |
// since-cxx20-note@cwg1884_A.cppm:63 {{previous declaration is here}} |
| 303 |
|
| 304 |
|
| 305 |
// Part C: matching against `enum E { c };` |
| 306 |
// ---------------------------------------- |
| 307 |
|
| 308 |
int c1; |
| 309 |
// since-cxx20-error@-1 {{redefinition of 'c1' as different kind of symbol}} |
| 310 |
// since-cxx20-note@cwg1884_A.cppm:65 {{previous definition is here}} |
| 311 |
void c2(); |
| 312 |
// since-cxx20-error@-1 {{redefinition of 'c2' as different kind of symbol}} |
| 313 |
// since-cxx20-note@cwg1884_A.cppm:66 {{previous definition is here}} |
| 314 |
namespace c3 {} |
| 315 |
// since-cxx20-error@-1 {{redefinition of 'c3' as different kind of symbol}} |
| 316 |
// since-cxx20-note@cwg1884_A.cppm:67 {{previous definition is here}} |
| 317 |
struct c4; |
| 318 |
// @-1 OK, types and enumerators do not correspond |
| 319 |
template <typename> |
| 320 |
class c5; |
| 321 |
// since-cxx20-error@-1 {{redefinition of 'c5' as different kind of symbol}} |
| 322 |
// since-cxx20-note@cwg1884_A.cppm:69 {{previous definition is here}} |
| 323 |
template <typename> |
| 324 |
void c6(int); |
| 325 |
// since-cxx20-error@-1 {{redefinition of 'c6' as different kind of symbol}} |
| 326 |
// since-cxx20-note@cwg1884_A.cppm:70 {{previous definition is here}} |
| 327 |
template <typename, typename> |
| 328 |
int c7; |
| 329 |
// since-cxx20-error@-1 {{redefinition of 'c7' as different kind of symbol}} |
| 330 |
// since-cxx20-note@cwg1884_A.cppm:71 {{previous definition is here}} |
| 331 |
template <typename T> |
| 332 |
int c8<T, int>; |
| 333 |
// since-cxx20-error@-1 {{redefinition of 'c8' as different kind of symbol}} |
| 334 |
// since-cxx20-note@cwg1884_A.cppm:72 {{previous definition is here}} |
| 335 |
// since-cxx20-error@-3 {{expected ';' after top level declarator}} |
| 336 |
template <typename> |
| 337 |
using c9 = int; |
| 338 |
// since-cxx20-error@-1 {{redefinition of 'c9' as different kind of symbol}} |
| 339 |
// since-cxx20-note@cwg1884_A.cppm:73 {{previous definition is here}} |
| 340 |
template <typename> |
| 341 |
concept c10 = true; |
| 342 |
// since-cxx20-error@-1 {{redefinition of 'c10' as different kind of symbol}} |
| 343 |
// since-cxx20-note@cwg1884_A.cppm:74 {{previous definition is here}} |
| 344 |
|
| 345 |
|
| 346 |
// Part D: matching against `namespace d {};` |
| 347 |
// ------------------------------------------ |
| 348 |
|
| 349 |
int d1; |
| 350 |
// since-cxx20-error@-1 {{redefinition of 'd1' as different kind of symbol}} |
| 351 |
// since-cxx20-note@cwg1884_A.cppm:76 {{previous definition is here}} |
| 352 |
void d2(); |
| 353 |
// since-cxx20-error@-1 {{redefinition of 'd2' as different kind of symbol}} |
| 354 |
// since-cxx20-note@cwg1884_A.cppm:77 {{previous definition is here}} |
| 355 |
enum Ed { |
| 356 |
d3 |
| 357 |
// since-cxx20-error@-1 {{redefinition of 'd3'}} |
| 358 |
// since-cxx20-note@cwg1884_A.cppm:78 {{previous definition is here}} |
| 359 |
}; |
| 360 |
struct d4; |
| 361 |
// since-cxx20-error@-1 {{redefinition of 'd4' as different kind of symbol}} |
| 362 |
// since-cxx20-note@cwg1884_A.cppm:79 {{previous definition is here}} |
| 363 |
template <typename> |
| 364 |
class d5; |
| 365 |
// since-cxx20-error@-1 {{redefinition of 'd5' as different kind of symbol}} |
| 366 |
// since-cxx20-note@cwg1884_A.cppm:80 {{previous definition is here}} |
| 367 |
template <typename> |
| 368 |
void d6(int); |
| 369 |
// since-cxx20-error@-1 {{redefinition of 'd6' as different kind of symbol}} |
| 370 |
// since-cxx20-note@cwg1884_A.cppm:81 {{previous definition is here}} |
| 371 |
template <typename, typename> |
| 372 |
int d7; |
| 373 |
// since-cxx20-error@-1 {{redefinition of 'd7' as different kind of symbol}} |
| 374 |
// since-cxx20-note@cwg1884_A.cppm:82 {{previous definition is here}} |
| 375 |
template <typename T> |
| 376 |
int d8<T, int>; |
| 377 |
// since-cxx20-error@-1 {{redefinition of 'd8' as different kind of symbol}} |
| 378 |
// since-cxx20-note@cwg1884_A.cppm:83 {{previous definition is here}} |
| 379 |
// since-cxx20-error@-3 {{expected ';' after top level declarator}} |
| 380 |
template <typename> |
| 381 |
using d9 = int; |
| 382 |
// since-cxx20-error@-1 {{redefinition of 'd9' as different kind of symbol}} |
| 383 |
// since-cxx20-note@cwg1884_A.cppm:84 {{previous definition is here}} |
| 384 |
template <typename> |
| 385 |
concept d10 = true; |
| 386 |
// since-cxx20-error@-1 {{redefinition of 'd10' as different kind of symbol}} |
| 387 |
// since-cxx20-note@cwg1884_A.cppm:85 {{previous definition is here}} |
| 388 |
|
| 389 |
|
| 390 |
// Part E: matching against `struct e;` |
| 391 |
// ------------------------------------ |
| 392 |
|
| 393 |
int e1; |
| 394 |
// @-1 OK, types and variables do not correspond |
| 395 |
void e2(); |
| 396 |
// @-1 OK, types and functions do not correspond |
| 397 |
enum Ee { |
| 398 |
e3 |
| 399 |
// @-1 OK, types and enumerators do not correspond |
| 400 |
}; |
| 401 |
namespace e4 {} |
| 402 |
// since-cxx20-error@-1 {{redefinition of 'e4' as different kind of symbol}} |
| 403 |
// since-cxx20-note@cwg1884_A.cppm:89 {{previous definition is here}} |
| 404 |
template <typename> |
| 405 |
class e5; |
| 406 |
// since-cxx20-error@-1 {{redefinition of 'e5' as different kind of symbol}} |
| 407 |
// since-cxx20-note@cwg1884_A.cppm:90 {{previous definition is here}} |
| 408 |
template <typename> |
| 409 |
void e6(int); |
| 410 |
// @-1 OK, types and function templates do not correspond |
| 411 |
template <typename, typename> |
| 412 |
int e7; |
| 413 |
// since-cxx20-error@-1 {{redefinition of 'e7' as different kind of symbol}} |
| 414 |
// since-cxx20-note@cwg1884_A.cppm:92 {{previous definition is here}} |
| 415 |
template <typename T> |
| 416 |
int e8<T, int>; |
| 417 |
// since-cxx20-error@-1 {{redefinition of 'e8' as different kind of symbol}} |
| 418 |
// since-cxx20-note@cwg1884_A.cppm:93 {{previous definition is here}} |
| 419 |
// since-cxx20-error@-3 {{expected ';' after top level declarator}} |
| 420 |
template <typename> |
| 421 |
using e9 = int; |
| 422 |
// since-cxx20-error@-1 {{redefinition of 'e9' as different kind of symbol}} |
| 423 |
// since-cxx20-note@cwg1884_A.cppm:94 {{previous definition is here}} |
| 424 |
template <typename> |
| 425 |
concept e10 = true; |
| 426 |
// since-cxx20-error@-1 {{redefinition of 'e10' as different kind of symbol}} |
| 427 |
// since-cxx20-note@cwg1884_A.cppm:95 {{previous definition is here}} |
| 428 |
// FIXME: the following forward declaration is well-formed. |
| 429 |
// Agreement on 'struct' vs 'class' is not required per [dcl.type.elab]/7. |
| 430 |
class e11; |
| 431 |
// since-cxx20-error@-1 {{declaration of 'e11' in the global module follows declaration in module cwg1884_A}} |
| 432 |
// since-cxx20-note@cwg1884_A.cppm:96 {{previous declaration is here}} |
| 433 |
union e12; |
| 434 |
// since-cxx20-error@-1 {{use of 'e12' with tag type that does not match previous declaration}} |
| 435 |
// since-cxx20-note@cwg1884_A.cppm:97 {{previous use is here}} |
| 436 |
// since-cxx20-error@-3 {{declaration of 'e12' in the global module follows declaration in module cwg1884_A}} |
| 437 |
// since-cxx20-note@cwg1884_A.cppm:97 {{previous declaration is here}} |
| 438 |
enum e13 {}; |
| 439 |
// since-cxx20-error@-1 {{use of 'e13' with tag type that does not match previous declaration}} |
| 440 |
// since-cxx20-note@cwg1884_A.cppm:98 {{previous use is here}} |
| 441 |
|
| 442 |
|
| 443 |
// Part F: matching against `template <typename> class f;` |
| 444 |
// ------------------------------------------------------- |
| 445 |
|
| 446 |
int f1; |
| 447 |
// since-cxx20-error@-1 {{redefinition of 'f1' as different kind of symbol}} |
| 448 |
// since-cxx20-note@cwg1884_A.cppm:100 {{previous definition is here}} |
| 449 |
void f2(); |
| 450 |
// since-cxx20-error@-1 {{redefinition of 'f2' as different kind of symbol}} |
| 451 |
// since-cxx20-note@cwg1884_A.cppm:102 {{previous definition is here}} |
| 452 |
enum Ef { |
| 453 |
f3 |
| 454 |
// since-cxx20-error@-1 {{redefinition of 'f3'}} |
| 455 |
// since-cxx20-note@cwg1884_A.cppm:104 {{previous definition is here}} |
| 456 |
}; |
| 457 |
namespace f4 {} |
| 458 |
// since-cxx20-error@-1 {{redefinition of 'f4' as different kind of symbol}} |
| 459 |
// since-cxx20-note@cwg1884_A.cppm:106 {{previous definition is here}} |
| 460 |
struct f5; |
| 461 |
// since-cxx20-error@-1 {{redefinition of 'f5' as different kind of symbol}} |
| 462 |
// since-cxx20-note@cwg1884_A.cppm:108 {{previous definition is here}} |
| 463 |
template <typename> |
| 464 |
void f6(int); |
| 465 |
// since-cxx20-error@-1 {{redefinition of 'f6' as different kind of symbol}} |
| 466 |
// since-cxx20-note@cwg1884_A.cppm:110 {{previous definition is here}} |
| 467 |
template <typename, typename> |
| 468 |
int f7; |
| 469 |
// since-cxx20-error@-1 {{redefinition of 'f7' as different kind of symbol}} |
| 470 |
// since-cxx20-note@cwg1884_A.cppm:112 {{previous definition is here}} |
| 471 |
template <typename T> |
| 472 |
int f8<T, int>; |
| 473 |
// since-cxx20-error@-1 {{no variable template matches partial specialization}} |
| 474 |
template <typename> |
| 475 |
using f9 = int; |
| 476 |
// since-cxx20-error@-1 {{redefinition of 'f9' as different kind of symbol}} |
| 477 |
// since-cxx20-note@cwg1884_A.cppm:116 {{previous definition is here}} |
| 478 |
template <typename> |
| 479 |
concept f10 = true; |
| 480 |
// since-cxx20-error@-1 {{redefinition of 'f10' as different kind of symbol}} |
| 481 |
// since-cxx20-note@cwg1884_A.cppm:118 {{previous definition is here}} |
| 482 |
|
| 483 |
|
| 484 |
// Part G: matching against `template <typename> void g(int);` |
| 485 |
// ----------------------------------------------------------- |
| 486 |
|
| 487 |
int g1; |
| 488 |
// since-cxx20-error@-1 {{redefinition of 'g1' as different kind of symbol}} |
| 489 |
// since-cxx20-note@cwg1884_A.cppm:122 {{previous definition is here}} |
| 490 |
void g2(); |
| 491 |
// @-1 OK, a non-corresponding overload |
| 492 |
enum Eg { |
| 493 |
g3 |
| 494 |
// MISSING-since-cxx20-error@-1 {{redefinition of 'g3'}} |
| 495 |
// MISSING-since-cxx20-note@cwg1884_A.cppm:126 {{previous definition is here}} |
| 496 |
}; |
| 497 |
namespace g4 {} |
| 498 |
// MISSING-since-cxx20-error@-1 {{redefinition of 'g4' as different kind of symbol}} |
| 499 |
// MISSING-since-cxx20-note@cwg1884_A.cppm:128 {{previous definition is here}} |
| 500 |
struct g5; |
| 501 |
// @-1 OK, types and function templates do not correspond |
| 502 |
template <typename> |
| 503 |
class g6; |
| 504 |
// since-cxx20-error@-1 {{redefinition of 'g6' as different kind of symbol}} |
| 505 |
// since-cxx20-note@cwg1884_A.cppm:132 {{previous definition is here}} |
| 506 |
template <typename, typename> |
| 507 |
int g7; |
| 508 |
// since-cxx20-error@-1 {{redefinition of 'g7' as different kind of symbol}} |
| 509 |
// since-cxx20-note@cwg1884_A.cppm:134 {{previous definition is here}} |
| 510 |
template <typename T> |
| 511 |
int g8<T, int>; |
| 512 |
// since-cxx20-error@-1 {{no variable template matches specialization; did you mean to use 'g8' as function template instead?}} |
| 513 |
template <typename> |
| 514 |
using g9 = int; |
| 515 |
// since-cxx20-error@-1 {{redefinition of 'g9' as different kind of symbol}} |
| 516 |
// since-cxx20-note@cwg1884_A.cppm:138 {{previous definition is here}} |
| 517 |
template <typename> |
| 518 |
concept g10 = true; |
| 519 |
// since-cxx20-error@-1 {{redefinition of 'g10' as different kind of symbol}} |
| 520 |
// since-cxx20-note@cwg1884_A.cppm:140 {{previous definition is here}} |
| 521 |
|
| 522 |
|
| 523 |
// Part H: matching against `template <typename, typename> int h;` |
| 524 |
// --------------------------------------------------------------- |
| 525 |
|
| 526 |
int h1; |
| 527 |
// since-cxx20-error@-1 {{redefinition of 'h1' as different kind of symbol}} |
| 528 |
// since-cxx20-note@cwg1884_A.cppm:142 {{previous definition is here}} |
| 529 |
void h2(); |
| 530 |
// since-cxx20-error@-1 {{redefinition of 'h2' as different kind of symbol}} |
| 531 |
// since-cxx20-note@cwg1884_A.cppm:144 {{previous definition is here}} |
| 532 |
enum Eh { |
| 533 |
h3 |
| 534 |
// since-cxx20-error@-1 {{redefinition of 'h3'}} |
| 535 |
// since-cxx20-note@cwg1884_A.cppm:146 {{previous definition is here}} |
| 536 |
}; |
| 537 |
namespace h4 {} |
| 538 |
// since-cxx20-error@-1 {{redefinition of 'h4' as different kind of symbol}} |
| 539 |
// since-cxx20-note@cwg1884_A.cppm:148 {{previous definition is here}} |
| 540 |
struct h5; |
| 541 |
// since-cxx20-error@-1 {{redefinition of 'h5' as different kind of symbol}} |
| 542 |
// since-cxx20-note@cwg1884_A.cppm:150 {{previous definition is here}} |
| 543 |
template <typename> |
| 544 |
class h6; |
| 545 |
// since-cxx20-error@-1 {{redefinition of 'h6' as different kind of symbol}} |
| 546 |
// since-cxx20-note@cwg1884_A.cppm:152 {{previous definition is here}} |
| 547 |
template <typename> |
| 548 |
void h7(int); |
| 549 |
// since-cxx20-error@-1 {{redefinition of 'h7' as different kind of symbol}} |
| 550 |
// since-cxx20-note@cwg1884_A.cppm:154 {{previous definition is here}} |
| 551 |
template <typename T> |
| 552 |
int h8<T, int>; |
| 553 |
// @-1 OK, partial specialization |
| 554 |
template <typename> |
| 555 |
using h9 = int; |
| 556 |
// since-cxx20-error@-1 {{redefinition of 'h9' as different kind of symbol}} |
| 557 |
// since-cxx20-note@cwg1884_A.cppm:158 {{previous definition is here}} |
| 558 |
template <typename> |
| 559 |
concept h10 = true; |
| 560 |
// since-cxx20-error@-1 {{redefinition of 'h10' as different kind of symbol}} |
| 561 |
// since-cxx20-note@cwg1884_A.cppm:160 {{previous definition is here}} |
| 562 |
|
| 563 |
|
| 564 |
// Part I: matching against `template <typename> using i = int;` |
| 565 |
// ------------------------------------------------------------- |
| 566 |
|
| 567 |
int i1; |
| 568 |
// since-cxx20-error@-1 {{redefinition of 'i1' as different kind of symbol}} |
| 569 |
// since-cxx20-note@cwg1884_A.cppm:162 {{previous definition is here}} |
| 570 |
void i2(); |
| 571 |
// since-cxx20-error@-1 {{redefinition of 'i2' as different kind of symbol}} |
| 572 |
// since-cxx20-note@cwg1884_A.cppm:164 {{previous definition is here}} |
| 573 |
enum Ei { |
| 574 |
i3 |
| 575 |
// since-cxx20-error@-1 {{redefinition of 'i3'}} |
| 576 |
// since-cxx20-note@cwg1884_A.cppm:166 {{previous definition is here}} |
| 577 |
}; |
| 578 |
namespace i4 {} |
| 579 |
// since-cxx20-error@-1 {{redefinition of 'i4' as different kind of symbol}} |
| 580 |
// since-cxx20-note@cwg1884_A.cppm:168 {{previous definition is here}} |
| 581 |
struct i5; |
| 582 |
// since-cxx20-error@-1 {{redefinition of 'i5' as different kind of symbol}} |
| 583 |
// since-cxx20-note@cwg1884_A.cppm:170 {{previous definition is here}} |
| 584 |
template <typename> |
| 585 |
class i6; |
| 586 |
// since-cxx20-error@-1 {{redefinition of 'i6' as different kind of symbol}} |
| 587 |
// since-cxx20-note@cwg1884_A.cppm:172 {{previous definition is here}} |
| 588 |
template <typename> |
| 589 |
void i7(int); |
| 590 |
// since-cxx20-error@-1 {{redefinition of 'i7' as different kind of symbol}} |
| 591 |
// since-cxx20-note@cwg1884_A.cppm:174 {{previous definition is here}} |
| 592 |
template <typename, typename> |
| 593 |
int i8; |
| 594 |
// since-cxx20-error@-1 {{redefinition of 'i8' as different kind of symbol}} |
| 595 |
// since-cxx20-note@cwg1884_A.cppm:176 {{previous definition is here}} |
| 596 |
template <typename T> |
| 597 |
int i9<T, int>; |
| 598 |
// since-cxx20-error@-1 {{no variable template matches partial specialization}} |
| 599 |
template <typename> |
| 600 |
concept i10 = true; |
| 601 |
// since-cxx20-error@-1 {{redefinition of 'i10' as different kind of symbol}} |
| 602 |
// since-cxx20-note@cwg1884_A.cppm:180 {{previous definition is here}} |
| 603 |
|
| 604 |
|
| 605 |
// Part J: matching against `template <typename> concept j = true;` |
| 606 |
// ---------------------------------------------------------------- |
| 607 |
|
| 608 |
int j1; |
| 609 |
// since-cxx20-error@-1 {{redefinition of 'j1' as different kind of symbol}} |
| 610 |
// since-cxx20-note@cwg1884_A.cppm:184 {{previous definition is here}} |
| 611 |
void j2(); |
| 612 |
// since-cxx20-error@-1 {{redefinition of 'j2' as different kind of symbol}} |
| 613 |
// since-cxx20-note@cwg1884_A.cppm:186 {{previous definition is here}} |
| 614 |
enum Ej { |
| 615 |
j3 |
| 616 |
// since-cxx20-error@-1 {{redefinition of 'j3'}} |
| 617 |
// since-cxx20-note@cwg1884_A.cppm:188 {{previous definition is here}} |
| 618 |
}; |
| 619 |
namespace j4 {} |
| 620 |
// since-cxx20-error@-1 {{redefinition of 'j4' as different kind of symbol}} |
| 621 |
// since-cxx20-note@cwg1884_A.cppm:190 {{previous definition is here}} |
| 622 |
struct j5; |
| 623 |
// since-cxx20-error@-1 {{redefinition of 'j5' as different kind of symbol}} |
| 624 |
// since-cxx20-note@cwg1884_A.cppm:192 {{previous definition is here}} |
| 625 |
template <typename> |
| 626 |
class j6; |
| 627 |
// since-cxx20-error@-1 {{redefinition of 'j6' as different kind of symbol}} |
| 628 |
// since-cxx20-note@cwg1884_A.cppm:194 {{previous definition is here}} |
| 629 |
template <typename> |
| 630 |
void j7(int); |
| 631 |
// since-cxx20-error@-1 {{redefinition of 'j7' as different kind of symbol}} |
| 632 |
// since-cxx20-note@cwg1884_A.cppm:196 {{previous definition is here}} |
| 633 |
template <typename, typename> |
| 634 |
int j8; |
| 635 |
// since-cxx20-error@-1 {{redefinition of 'j8' as different kind of symbol}} |
| 636 |
// since-cxx20-note@cwg1884_A.cppm:198 {{previous definition is here}} |
| 637 |
template <typename T> |
| 638 |
int j9<T, int>; |
| 639 |
// since-cxx20-error@-1 {{no variable template matches partial specialization}} |
| 640 |
template <typename> |
| 641 |
using j10 = int; |
| 642 |
// since-cxx20-error@-1 {{redefinition of 'j10' as different kind of symbol}} |
| 643 |
// since-cxx20-note@cwg1884_A.cppm:202 {{previous definition is here}} |