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 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260
|
// RUN: %clang_cc1 -std=c++98 %s -verify=expected,cxx98-23,cxx98-11,cxx98-14,cxx98-17,cxx98 -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++11 %s -verify=expected,cxx98-23,cxx98-11,cxx98-14,cxx98-17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++14 %s -verify=expected,cxx98-23,cxx98-14,cxx98-17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++17 %s -verify=expected,cxx98-23,since-cxx17,cxx98-17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++20 %s -verify=expected,cxx98-23,since-cxx20,since-cxx17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++23 %s -verify=expected,cxx98-23,since-cxx23,since-cxx20,since-cxx17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++2c %s -verify=expected,since-cxx26,since-cxx23,since-cxx20,since-cxx17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
#if __cplusplus == 199711L
#define static_assert(...) __extension__ _Static_assert(__VA_ARGS__)
// cxx98-error@-1 {{variadic macros are a C99 feature}}
#endif
// FIXME: This is included to avoid a diagnostic with no source location
// pointing at the implicit operator new. We can't match such a diagnostic
// with -verify.
__extension__ typedef __SIZE_TYPE__ size_t;
void *operator new(size_t); // #cwg5xx-global-operator-new
// cxx98-error@-1 {{'operator new' is missing exception specification 'throw(std::bad_alloc)'}}
#if __cplusplus > 201402L
namespace std {
enum class align_val_t : size_t {};
}
void *operator new(size_t, std::align_val_t); // #cwg5xx-global-operator-new-aligned
#endif
namespace std {
struct type_info;
}
namespace cwg500 { // cwg500: dup 372
class D;
class A {
class B;
class C;
friend class D;
};
class A::B {};
class A::C : public A::B {};
class D : public A::B {};
}
namespace cwg501 { // cwg501: yes
struct A {
friend void f() {}
void g() {
void (*p)() = &f;
// expected-error@-1 {{use of undeclared identifier 'f'}}
}
};
}
namespace cwg502 { // cwg502: yes
struct Q {};
template<typename T> struct A {
enum E { e = 1 };
void q1() { f(e); }
void q2() { Q arr[sizeof(E)]; f(arr); }
void q3() { Q arr[e]; f(arr); }
void sanity() { Q arr[1]; f(arr); }
// expected-error@-1 {{use of undeclared identifier 'f'}}
};
int f(A<int>::E);
template<int N> int f(Q (&)[N]);
template struct A<int>;
}
namespace cwg505 { // cwg505: yes
const char *exts = "\e\(\{\[\%";
// expected-error@-1 {{use of non-standard escape character '\e'}}
// expected-error@-2 {{use of non-standard escape character '\('}}
// expected-error@-3 {{use of non-standard escape character '\{'}}
// expected-error@-4 {{use of non-standard escape character '\['}}
// expected-error@-5 {{use of non-standard escape character '\%'}}
const char *unknown = "\Q";
// expected-error@-1 {{unknown escape sequence '\Q'}}
}
namespace cwg506 { // cwg506: yes
struct NonPod { ~NonPod(); };
void f(...);
void g(NonPod np) { f(np); }
// cxx98-error@-1 {{cannot pass object of non-POD type 'NonPod' through variadic function; call will abort at runtime}}
// since-cxx11-error@-2 {{cannot pass object of non-trivial type 'NonPod' through variadic function; call will abort at runtime}}
}
// FIXME: Add tests here once CWG260 is resolved.
// cwg507: dup 260
// cwg508: na
// cwg509: na
// cwg510: na
namespace cwg512 { // cwg512: yes
struct A { // #cwg512-A
A(int); // #cwg512-A-ctor
};
union U { A a; };
// cxx98-error@-1 {{union member 'a' has a non-trivial default constructor}}
// cxx98-note@#cwg512-A {{because type 'cwg512::A' has no default constructor}}
// cxx98-note@#cwg512-A-ctor {{implicit default constructor suppressed by user-declared constructor}}
}
// cwg513: na
namespace cwg514 { // cwg514: yes
namespace A { extern int x, y; }
int A::x = y;
}
namespace cwg515 { // cwg515: sup 1017
// FIXME: cwg1017 reverses the wording of cwg515, but the current draft has
// cwg515's wording, with a different fix for cwg1017.
struct X { int n; };
template<typename T> struct Y : T {
int f() { return X::n; }
};
int k = Y<X>().f();
struct A { int a; };
struct B { void f() { int k = sizeof(A::a); } };
// cxx98-error@-1 {{invalid use of non-static data member 'a'}}
}
// cwg516: na
namespace cwg517 { // cwg517: no
// This is NDR, but we should diagnose it anyway.
template<typename T> struct S {};
template<typename T> int v = 0;
// cxx98-11-error@-1 {{variable templates are a C++14 extension}}
template struct S<int*>;
template int v<int*>;
S<char&> s;
int k = v<char&>;
// FIXME: These are both ill-formed.
template<typename T> struct S<T*> {};
template<typename T> int v<T*> = 0;
// FIXME: These are both ill-formed.
template<typename T> struct S<T&> {};
template<typename T> int v<T&> = 0;
}
namespace cwg518 { // cwg518: yes c++11
enum E { e, };
// cxx98-error@-1 {{commas at the end of enumerator lists are a C++11 extension}}
}
// cwg519 is in cwg519.cpp
// cwg520: na
// cwg521: no
// FIXME: The wording here is broken. It's not reasonable to expect a
// diagnostic here. Once the relevant DR gets a number, mark this as a dup.
namespace cwg522 { // cwg522: yes
struct S {};
template<typename T> void b1(volatile T &);
template<typename T> void b2(volatile T * const *);
template<typename T> void b2(volatile T * const S::*);
template<typename T> void b2(volatile T * const S::* const *);
template<typename T> void b2a(volatile T *S::* const *); // #cwg522-b2a
template<typename T> struct Base {};
struct Derived : Base<int> {};
template<typename T> void b3(Base<T>);
template<typename T> void b3(Base<T> *);
void test(int n, const int cn, int **p, int *S::*pm) {
int *a[3], *S::*am[3];
const Derived cd = Derived();
Derived d[3];
b1(n);
b1(cn);
b2(p);
b2(pm);
b2(a);
b2(am);
b2a(am);
// expected-error@-1 {{no matching function for call to 'b2a'}}
// expected-note@#cwg522-b2a {{candidate template ignored: deduced type 'volatile int *cwg522::S::*const *' of 1st parameter does not match adjusted type 'int *cwg522::S::**' of argument}}
b3(d);
b3(cd);
}
}
namespace cwg524 { // cwg524: yes
template<typename T> void f(T a, T b) { operator+(a, b); }
// expected-error@-1 {{call to function 'operator+' that is neither visible in the template definition nor found by argument-dependent lookup}}
// expected-note@#cwg524-f-N-S {{in instantiation of function template specialization 'cwg524::f<cwg524::N::S>' requested here}}
// expected-note@#cwg524-operator-plus {{'operator+' should be declared prior to the call site or in namespace 'cwg524::N'}}
struct S {};
void operator+(S, S);
template void f(S, S);
namespace N { struct S {}; }
void operator+(N::S, N::S); // #cwg524-operator-plus
template void f(N::S, N::S); // #cwg524-f-N-S
}
namespace cwg525 { // cwg525: yes
namespace before {
// Note, the example was correct prior to the change; instantiation is
// required for cases like this:
template <class T> struct D { operator T*(); };
void g(D<double> ppp) {
delete ppp;
}
}
namespace after {
template <class T> struct D { typename T::error e; };
// expected-error@-1 {{type 'double' cannot be used prior to '::' because it has no members}}
// expected-note@#cwg525-ppp {{in instantiation of template class 'cwg525::after::D<double>' requested here}}
void g(D<double> *ppp) {
delete ppp; // #cwg525-ppp
}
}
}
namespace cwg526 { // cwg526: yes
template<int> struct S {};
template<int N> void f1(S<N> s);
template<int N> void f2(S<(N)> s); // #cwg526-f2
template<int N> void f3(S<+N> s); // #cwg526-f3
template<int N> void g1(int (&)[N]);
template<int N> void g2(int (&)[(N)]); // #cwg526-g2
template<int N> void g3(int (&)[+N]); // #cwg526-g3
void test(int (&a)[3], S<3> s) {
f1(s);
f2(s);
// expected-error@-1 {{no matching function for call to 'f2'}}
// expected-note@#cwg526-f2 {{candidate template ignored: couldn't infer template argument 'N'}}
f3(s);
// expected-error@-1 {{no matching function for call to 'f3'}}
// expected-note@#cwg526-f3 {{candidate template ignored: couldn't infer template argument 'N'}}
g1(a);
g2(a);
// expected-error@-1 {{no matching function for call to 'g2'}}
// expected-note@#cwg526-g2 {{candidate template ignored: couldn't infer template argument 'N'}}
g3(a);
// expected-error@-1 {{no matching function for call to 'g3'}}
// expected-note@#cwg526-g3 {{candidate template ignored: couldn't infer template argument 'N'}}
}
template<int N> struct X {
typedef int type;
X<N>::type v1;
X<(N)>::type v2;
// cxx98-17-error@-1 {{missing 'typename' prior to dependent type name X<(N)>::type; implicit 'typename' is a C++20 extension}}
X<+N>::type v3;
// cxx98-17-error@-1 {{missing 'typename' prior to dependent type name X<+N>::type; implicit 'typename' is a C++20 extension}}
};
}
namespace cwg527 { // cwg527: na
// This DR is meaningless. It removes a required diagnostic from the case
// where a not-externally-visible object is odr-used but not defined, which
// requires a diagnostic for a different reason.
extern struct { int x; } a; // FIXME: We should reject this, per cwg389.
static struct { int x; } b;
extern "C" struct { int x; } c;
namespace { extern struct { int x; } d; }
typedef struct { int x; } *P;
struct E { static P e; }; // FIXME: We should reject this, per cwg389.
namespace { struct F { static P f; }; }
int ax = a.x, bx = b.x, cx = c.x, dx = d.x, ex = E::e->x, fx = F::f->x;
}
namespace cwg528 { // cwg528: 2.7
struct S; // #cwg528-S
void f() {
typeid(S);
// expected-error@-1 {{'typeid' of incomplete type 'S'}}
// expected-note@#cwg528-S {{forward declaration of 'cwg528::S'}}
}
} // namespace cwg528
namespace cwg530 { // cwg530: yes
template<int*> struct S { enum { N = 1 }; };
template<void(*)()> struct T { enum { N = 1 }; };
int n;
void f();
int a[S<&n>::N];
int b[T<&f>::N];
}
namespace cwg531 { // cwg531: partial
namespace good {
template<typename T> struct A {
void f(T) { T::error; }
template<typename U> void g(T, U) { T::error; }
struct B { typename T::error error; };
template<typename U> struct C { typename T::error error; };
static T n;
};
template<typename T> T A<T>::n = T::error;
template<> void A<int>::f(int) {}
template<> template<typename U> void A<int>::g(int, U) {}
template<> struct A<int>::B {};
template<> template<typename U> struct A<int>::C {};
template<> int A<int>::n = 0;
void use(A<int> a) {
a.f(a.n);
a.g(0, 0);
A<int>::B b;
A<int>::C<int> c;
}
template<> struct A<char> {
void f(char);
template<typename U> void g(char, U);
struct B;
template<typename U> struct C;
static char n;
};
void A<char>::f(char) {}
template<typename U> void A<char>::g(char, U) {}
struct A<char>::B {};
template<typename U> struct A<char>::C {};
char A<char>::n = 0;
}
namespace bad {
template<typename T> struct A {
void f(T) { T::error; }
template<typename U> void g(T, U) { T::error; }
struct B { typename T::error error; };
template<typename U> struct C { typename T::error error; }; // #cwg531-C
static T n;
};
template<typename T> T A<T>::n = T::error;
void A<int>::f(int) {}
// expected-error@-1 {{template specialization requires 'template<>'}}
template<typename U> void A<int>::g(int, U) {}
// expected-error@-1 {{template parameter list matching the non-templated nested type 'cwg531::bad::A<int>' should be empty}}
struct A<int>::B {};
// expected-error@-1 {{template specialization requires 'template<>'}}
template<typename U> struct A<int>::C {};
// expected-error@-1 {{template parameter list matching the non-templated nested type 'cwg531::bad::A<int>' should be empty}}
// expected-error@-2 {{redefinition of 'C' as different kind of symbol}}
// expected-note@#cwg531-C {{previous definition is here}}
int A<int>::n = 0;
// expected-error@-1 {{template specialization requires 'template<>'}}
template<> struct A<char> { // #cwg531-A-char
void f(char);
template<typename U> void g(char, U);
struct B; // #cwg531-B
template<typename U> struct C;
static char n;
};
template<> void A<char>::f(char) {}
// expected-error@-1 {{no function template matches function template specialization 'f'}}
template<> template<typename U> void A<char>::g(char, U) {}
// expected-error@-1 {{extraneous template parameter list in template specialization}}
// expected-note@#cwg531-A-char {{'template<>' header not required for explicitly-specialized class 'cwg531::bad::A<char>' declared here}}
template<> struct A<char>::B {};
// expected-error@-1 {{extraneous 'template<>' in declaration of struct 'B'}}
// expected-error@-2 {{specialization of member 'cwg531::bad::A<char>::B' does not specialize an instantiated member}}
// expected-note@#cwg531-B {{attempt to specialize declaration here}}
template<> template<typename U> struct A<char>::C {};
// expected-error@-1 {{extraneous template parameter list in template specialization}}
// expected-note@#cwg531-A-char {{'template<>' header not required for explicitly-specialized class 'cwg531::bad::A<char>' declared here}}
template<> char A<char>::n = 0;
// expected-error@-1 {{extraneous 'template<>' in declaration of variable 'n'}}
}
namespace nested {
template<typename T> struct A {
template<typename U> struct B;
};
template<> template<typename U> struct A<int>::B {
void f();
void g();
template<typename V> void h();
template<typename V> void i();
};
template<> template<typename U> void A<int>::B<U>::f() {}
template<typename U> void A<int>::B<U>::g() {}
// expected-error@-1 {{template parameter list matching the non-templated nested type 'cwg531::nested::A<int>' should be empty ('template<>')}}
template<> template<typename U> template<typename V> void A<int>::B<U>::h() {}
template<typename U> template<typename V> void A<int>::B<U>::i() {}
// expected-error@-1 {{template parameter list matching the non-templated nested type 'cwg531::nested::A<int>' should be empty ('template<>')}}
#if __cplusplus <= 201703L
// FIXME: All of those declarations shouldn't crash in C++20 mode.
template<> template<> void A<int>::B<int>::f() {}
template<> template<> template<typename V> void A<int>::B<int>::h() {}
template<> template<> template<> void A<int>::B<int>::h<int>() {}
template<> void A<int>::B<char>::f() {}
// cxx98-17-error@-1 {{template specialization requires 'template<>'}}
template<> template<typename V> void A<int>::B<char>::h() {}
// cxx98-17-error@-1 {{template parameter list matching the non-templated nested type 'cwg531::nested::A<int>::B<char>' should be empty ('template<>')}}
#endif
}
}
// PR8130
namespace cwg532 { // cwg532: 3.5
struct A { };
template<class T> struct B {
template<class R> int &operator*(R&);
};
template<class T, class R> float &operator*(T&, R&);
void test() {
A a;
B<A> b;
int &ir = b * a;
}
}
// cwg533: na
namespace cwg534 { // cwg534: 2.9
struct S {};
template<typename T> void operator+(S, T);
template<typename T> void operator+<T*>(S, T*) {}
// expected-error@-1 {{function template partial specialization is not allowed}}
}
namespace cwg535 { // cwg535: yes
class X { private: X(const X&); };
struct A {
X x;
template<typename T> A(T&);
};
struct B : A {
X y;
B(volatile A&);
};
extern A a1;
A a2(a1); // ok, uses constructor template
extern volatile B b1;
B b2(b1); // ok, uses converting constructor
void f() { throw a1; }
#if __cplusplus >= 201103L
struct C {
constexpr C() : n(0) {}
template<typename T> constexpr C(T&t) : n(t.n == 0 ? throw 0 : 0) {}
int n;
};
constexpr C c() { return C(); }
// ok, copy is elided
constexpr C x = c();
#endif
}
// cwg536: na
// cwg537: na
// cwg538: na
// cwg539: yes
const cwg539(
// expected-error@-1 {{a type specifier is required for all declarations}}
const a) {
// expected-error@-1 {{unknown type name 'a'}}
const b;
// expected-error@-1 {{a type specifier is required for all declarations}}
new const;
// expected-error@-1 {{expected a type}}
try {} catch (const n) {}
// expected-error@-1 {{unknown type name 'n'}}
try {} catch (const) {}
// expected-error@-1 {{expected a type}}
if (const n = 0) {}
// expected-error@-1 {{a type specifier is required for all declarations}}
switch (const n = 0) {}
// expected-error@-1 {{a type specifier is required for all declarations}}
while (const n = 0) {}
// expected-error@-1 {{a type specifier is required for all declarations}}
for (const n = 0;
// expected-error@-1 {{a type specifier is required for all declarations}}
const m = 0; ) {}
// expected-error@-1 {{a type specifier is required for all declarations}}
sizeof(const);
// expected-error@-1 {{a type specifier is required for all declarations}}
struct S {
const n;
// expected-error@-1 {{a type specifier is required for all declarations}}
operator const();
// expected-error@-1 {{expected a type}}
};
#if __cplusplus >= 201103L
int arr[3];
// FIXME: The extra braces here are to avoid the parser getting too
// badly confused when recovering here. We should fix this recovery.
{ for (const n
// since-cxx11-error@-1 {{unknown type name 'n'}}
// since-cxx11-note@-2 {{}}
: arr) ; {} }
// since-cxx11-error@-1 +{{}}
(void) [](const) {};
// since-cxx11-error@-1 {{a type specifier is required for all declarations}}
(void) [](const n) {};
// since-cxx11-error@-1 {{unknown type name 'n'}}
enum E : const {};
// since-cxx11-error@-1 {{expected a type}}
using T = const;
// since-cxx11-error@-1 {{expected a type}}
auto f() -> const;
// since-cxx11-error@-1 {{expected a type}}
#endif
}
namespace cwg540 { // cwg540: yes
typedef int &a;
typedef const a &a;
// expected-warning@-1 {{'const' qualifier on reference type 'a' (aka 'int &') has no effect}}
typedef const int &b;
typedef b &b;
typedef const a &c; // #cwg540-typedef-a-c
// expected-warning@-1 {{'const' qualifier on reference type 'a' (aka 'int &') has no effect}}
typedef const b &c; // #cwg540-typedef-b-c
// expected-error@#cwg540-typedef-b-c {{typedef redefinition with different types ('const int &' vs 'int &')}}
// expected-note@#cwg540-typedef-a-c {{previous definition is here}}
// expected-warning@#cwg540-typedef-b-c {{'const' qualifier on reference type 'b' (aka 'const int &') has no effect}}
}
namespace cwg541 { // cwg541: yes
template<int> struct X { typedef int type; };
template<typename T> struct S {
int f(T);
int g(int);
T g(bool);
int h();
int h(T);
void x() {
// These are type-dependent expressions, even though we could
// determine that all calls have type 'int'.
X<sizeof(f(0))>::type a;
// expected-error@-1 {{expected ';' after expression}}
// expected-error@-2 {{use of undeclared identifier 'a'}}
X<sizeof(g(0))>::type b;
// expected-error@-1 {{expected ';' after expression}}
// expected-error@-2 {{use of undeclared identifier 'b'}}
X<sizeof(h(0))>::type b;
// expected-error@-1 {{expected ';' after expression}}
// expected-error@-2 {{use of undeclared identifier 'b'}}
typename X<sizeof(f(0))>::type a;
typename X<sizeof(h(0))>::type b;
}
};
}
namespace cwg542 { // cwg542: yes
#if __cplusplus >= 201103L
// In C++20 A and B are no longer aggregates and thus the constructor is
// called, which fails.
struct A { A() = delete; int n; }; // #cwg542-A
// ok, constructor not called
A a[32] = {}; // #cwg542-a
// since-cxx20-error@-1 {{call to deleted constructor of 'A'}}
// since-cxx20-note@#cwg542-A {{'A' has been explicitly marked deleted here}}
// since-cxx20-note@#cwg542-a {{in implicit initialization of array element 0 with omitted initializer}}
struct B {
int n;
private:
B() = default; // #cwg542-B-ctor
};
B b[32] = {}; // ok, constructor not called
// since-cxx20-error@-1 {{calling a private constructor of class 'cwg542::B'}}
// since-cxx20-note@#cwg542-B-ctor {{declared private here}}
#endif
}
namespace cwg543 { // cwg543: 3.0
// In C++98+CWG543, this is valid because value-initialization doesn't call a
// trivial default constructor, so we never notice that defining the
// constructor would be ill-formed.
//
// In C++11+CWG543, this is ill-formed, because the default constructor is
// deleted, and value-initialization *does* call a deleted default
// constructor, even if it is trivial.
struct A {
const int n; // #cwg543-A-n
};
A a = A();
// since-cxx11-error@-1 {{call to implicitly-deleted default constructor of 'A'}}
// since-cxx11-note@#cwg543-A-n {{default constructor of 'A' is implicitly deleted because field 'n' of const-qualified type 'const int' would not be initialized}}
}
namespace cwg544 { // cwg544: yes
int *n;
template<class T> struct A { int n; };
template<class T> struct B : A<T> { int get(); };
template<> int B<int>::get() { return n; }
int k = B<int>().get();
}
namespace cwg546 { // cwg546: yes
template<typename T> struct A { void f(); };
template struct A<int>;
template<typename T> void A<T>::f() { T::error; }
}
namespace cwg547 { // cwg547: 3.2
template<typename T> struct X;
template<typename T> struct X<T() const> {};
template<typename T, typename C> X<T> f(T C::*) { return X<T>(); }
struct S { void f() const; };
X<void() const> x = f(&S::f);
}
namespace cwg548 { // cwg548: dup 482
template<typename T> struct S {};
template<typename T> void f() {}
template struct cwg548::S<int>;
template void cwg548::f<int>();
}
// cwg550: dup 393
namespace cwg551 { // cwg551: yes c++11
// FIXME: This obviously should apply in C++98 mode too.
template<typename T> void f() {}
template inline void f<int>();
// since-cxx11-error@-1 {{explicit instantiation cannot be 'inline'}}
template<typename T> inline void g() {}
template inline void g<int>();
// since-cxx11-error@-1 {{explicit instantiation cannot be 'inline'}}
template<typename T> struct X {
void f() {}
};
template inline void X<int>::f();
// since-cxx11-error@-1 {{explicit instantiation cannot be 'inline'}}
}
namespace cwg552 { // cwg552: yes
template<typename T, typename T::U> struct X {};
struct Y { typedef int U; };
X<Y, 0> x;
}
// cwg553: 2.7
struct cwg553_class {
friend void *operator new(size_t, cwg553_class);
};
namespace cwg553 {
cwg553_class c;
// Contrary to the apparent intention of the DR, operator new is not actually
// looked up with a lookup mechanism that performs ADL; the standard says it
// "is looked up in global scope", where it is not visible.
void *p = new (c) int;
// expected-error@-1 {{no matching function for call to 'operator new'}}
// since-cxx17-note@#cwg5xx-global-operator-new-aligned {{candidate function not viable: no known conversion from 'cwg553_class' to 'std::align_val_t' for 2nd argument}}
// expected-note@#cwg5xx-global-operator-new {{candidate function not viable: requires 1 argument, but 2 were provided}}
struct namespace_scope {
friend void *operator new(size_t, namespace_scope);
// expected-error@-1 {{'operator new' cannot be declared inside a namespace}}
};
}
// cwg554: na
namespace cwg555 { // cwg555: 2.8
typedef int I;
typedef const int CI;
typedef volatile int VI;
void f(int *a, CI *b, VI *c) {
a->~I();
a->~CI();
a->~VI();
a->I::~I();
a->CI::~CI();
a->VI::~VI();
a->CI::~VI(); // allowed by changes to [expr.id.prim.qual]/2 introduced in P1131R2
b->~I();
b->~CI();
b->~VI();
b->I::~I();
b->CI::~CI();
b->VI::~VI();
c->~I();
c->~CI();
c->~VI();
c->I::~I();
c->CI::~CI();
c->VI::~VI();
}
void g(int &a, CI &b, VI &c) {
a.~I();
a.~CI();
a.~VI();
a.I::~I();
a.CI::~CI();
a.VI::~VI();
a.CI::~VI(); // allowed by changes to [expr.id.prim.qual]/2 introduced in P1131R2
b.~I();
b.~CI();
b.~VI();
b.I::~I();
b.CI::~CI();
b.VI::~VI();
c.~I();
c.~CI();
c.~VI();
c.I::~I();
c.CI::~CI();
c.VI::~VI();
}
} // namespace cwg555
// cwg556: na
namespace cwg557 { // cwg557: 3.1
template<typename T> struct S {
friend void f(S<T> *);
friend void g(S<S<T> > *);
};
void x(S<int> *p, S<S<int> > *q) {
f(p);
g(q);
}
}
namespace cwg558 { // cwg558: 2.9
wchar_t a = L'\uD7FF';
wchar_t b = L'\xD7FF';
wchar_t c = L'\uD800';
// expected-error@-1 {{invalid universal character}}
wchar_t d = L'\xD800';
wchar_t e = L'\uDFFF';
// expected-error@-1 {{invalid universal character}}
wchar_t f = L'\xDFFF';
wchar_t g = L'\uE000';
wchar_t h = L'\xE000';
}
template<typename> struct cwg559 { typedef int T; cwg559::T u; }; // cwg559: yes
namespace cwg560 { // cwg560: 16
template <class T>
struct Outer {
struct Inner {
Inner* self();
};
};
template <class T>
Outer<T>::Inner* Outer<T>::Inner::self() { return this; }
// cxx98-17-error@-1 {{missing 'typename' prior to dependent type name Outer<T>::Inner; implicit 'typename' is a C++20 extension}}
} // namespace cwg560
namespace cwg561 { // cwg561: yes
template<typename T> void f(int);
template<typename T> void g(T t) {
f<T>(t);
}
namespace {
struct S {};
template<typename T> static void f(S);
}
void h(S s) {
g(s);
}
}
// cwg562: na
namespace cwg564 { // cwg564: yes
extern "C++" void f(int);
void f(int); // ok
extern "C++" { extern int n; }
int n; // ok
}
namespace cwg565 { // cwg565: yes
namespace N {
template<typename T> int f(T); // #cwg565-f
}
using N::f; // #cwg565-using
template<typename T> int f(T*);
template<typename T> void f(T);
template<typename T, int = 0> int f(T);
// cxx98-error@-1 {{default template arguments for a function template are a C++11 extension}}
template<typename T> int f(T, int = 0);
template<typename T> int f(T);
// expected-error@-1 {{declaration conflicts with target of using declaration already in scope}}
// expected-note@#cwg565-f {{target of using declaration}}
// expected-note@#cwg565-using {{using declaration}}
}
namespace cwg566 { // cwg566: yes
#if __cplusplus >= 201103L
static_assert(int(-3.99) == -3, "");
#endif
}
// cwg567: na
namespace cwg568 { // cwg568: 3.0 c++11
// FIXME: This is a DR issue against C++98, so should probably apply there
// too.
struct x { int y; };
class trivial : x {
x y;
public:
int n;
};
static_assert(__is_trivial(trivial), "");
struct std_layout {
std_layout();
std_layout(const std_layout &);
~std_layout();
private:
int n;
};
static_assert(__is_standard_layout(std_layout), "");
struct aggregate {
int x;
int y;
trivial t;
std_layout sl;
};
aggregate aggr = {};
void f(...);
void g(trivial t) { f(t); }
// cxx98-error@-1 {{cannot pass object of non-POD type 'trivial' through variadic function; call will abort at runtime}}
void jump() {
goto x;
// cxx98-error@-1 {{cannot jump from this goto statement to its label}}
// cxx98-note@#cwg568-t {{jump bypasses initialization of non-POD variable}}
trivial t; // #cwg568-t
x: ;
}
}
namespace cwg569 { // cwg569: yes c++11
// FIXME: This is a DR issue against C++98, so should probably apply there
// too.
;;;;;
// cxx98-error@-1 {{C++11 extension}}
}
namespace cwg570 { // cwg570: dup 633
int n;
int &r = n; // #cwg570-r
int &r = n;
// expected-error@-1 {{redefinition of 'r'}}
// expected-note@#cwg570-r {{previous definition is here}}
}
// cwg571 is in cwg571.cpp
namespace cwg572 { // cwg572: yes
enum E { a = 1, b = 2 };
static_assert(a + b == 3, "");
}
namespace cwg573 { // cwg573: no
void *a;
int *b = reinterpret_cast<int*>(a);
void (*c)() = reinterpret_cast<void(*)()>(a);
// cxx98-error@-1 {{cast between pointer-to-function and pointer-to-object is an extension}}
void *d = reinterpret_cast<void*>(c);
// cxx98-error@-1 {{cast between pointer-to-function and pointer-to-object is an extension}}
void f() { delete a; }
// cxx98-23-error@-1 {{cannot delete expression with pointer-to-'void' type 'void *'}}
// since-cxx26-error@-2 {{cannot delete pointer to incomplete type 'void'}}
int n = d - a;
// expected-error@-1 {{arithmetic on pointers to void}}
// FIXME: This is ill-formed.
template<void*> struct S;
template<int*> struct T;
}
namespace cwg574 { // cwg574: 3.0
struct A {
A &operator=(const A&) const; // #cwg574-A-copy-assign
};
struct B {
B &operator=(const B&) volatile; // #cwg574-B-copy-assign
};
#if __cplusplus >= 201103L
struct C {
C &operator=(const C&) &; // #cwg574-C-copy-assign
};
struct D {
D &operator=(const D&) &&; // #cwg574-D-copy-assign
};
void test(C c, D d) {
c = c;
C() = c;
// since-cxx11-error@-1 {{no viable overloaded '='}}
// since-cxx11-note@#cwg574-C-copy-assign {{candidate function not viable: expects an lvalue for object argument}}
d = d;
// since-cxx11-error@-1 {{no viable overloaded '='}}
// since-cxx11-note@#cwg574-D-copy-assign {{candidate function not viable: expects an rvalue for object argument}}
D() = d;
}
#endif
struct Test {
friend A &A::operator=(const A&);
// expected-error@-1 {{friend declaration of 'operator=' does not match any declaration in 'cwg574::A'}}
// expected-note@#cwg574-A-copy-assign {{candidate function has different qualifiers (expected unqualified but found 'const')}}
friend B &B::operator=(const B&);
// expected-error@-1 {{friend declaration of 'operator=' does not match any declaration in 'cwg574::B'}}
// expected-note@#cwg574-B-copy-assign {{candidate function has different qualifiers (expected unqualified but found 'volatile')}}
#if __cplusplus >= 202302L
friend C &C::operator=(const C&);
// since-cxx23-error@-1 {{conflicting types for 'operator='}}
// since-cxx23-note@#cwg574-C-copy-assign {{previous declaration is here}}
friend D &D::operator=(const D&);
// since-cxx23-error@-1 {{conflicting types for 'operator='}}
// since-cxx23-note@#cwg574-D-copy-assign {{previous declaration is here}}
#elif __cplusplus >= 201103L
// FIXME: We shouldn't produce the 'cannot overload' diagnostics here.
friend C &C::operator=(const C&); // #cwg574-test-C
// since-cxx11-error@#cwg574-test-C {{cannot overload}}
// since-cxx11-note@#cwg574-C-copy-assign {{previous declaration is here}}
// since-cxx11-error@#cwg574-test-C {{friend declaration of 'operator=' does not match any declaration in 'cwg574::C'}}
// since-cxx11-note@#cwg574-C-copy-assign {{candidate function}}
friend D &D::operator=(const D&); // #cwg574-test-D
// since-cxx11-error@#cwg574-test-D {{cannot overload a member function without a ref-qualifier with a member function with ref-qualifier '&&'}}
// since-cxx11-note@#cwg574-D-copy-assign {{previous declaration is here}}
// since-cxx11-error@#cwg574-test-D {{friend declaration of 'operator=' does not match any declaration in 'cwg574::D'}}
// since-cxx11-note@#cwg574-D-copy-assign {{candidate function}}
#endif
};
}
namespace cwg575 { // cwg575: yes
template<typename T, typename U = typename T::type> void a(T); void a(...);
// cxx98-error@-1 {{default template arguments for a function template are a C++11 extension}}
template<typename T, typename T::type U = 0> void b(T); void b(...);
// cxx98-error@-1 {{default template arguments for a function template are a C++11 extension}}
template<typename T, int U = T::value> void c(T); void c(...);
// cxx98-error@-1 {{default template arguments for a function template are a C++11 extension}}
template<typename T> void d(T, int = T::value); void d(...);
// expected-error@-1 {{type 'int' cannot be used prior to '::' because it has no members}}
// expected-note@#cwg575-d {{in instantiation of default function argument expression for 'd<int>' required here}}
void x() {
a(0);
b(0);
c(0);
d(0); // #cwg575-d
}
template<typename T = int&> void f(T* = 0);
// cxx98-error@-1 {{default template arguments for a function template are a C++11 extension}}
template<typename T = int> void f(T = 0);
// cxx98-error@-1 {{default template arguments for a function template are a C++11 extension}}
void g() { f<>(); }
template<typename T> T &h(T *);
template<typename T> T *h(T *);
void *p = h((void*)0);
}
namespace cwg576 { // cwg576: 3.5
typedef void f() {}
// expected-error@-1 {{function definition declared 'typedef'}}
void f(typedef int n);
// expected-error@-1 {{invalid storage class specifier in function declarator}}
void f(char c) { typedef int n; }
}
namespace cwg577 { // cwg577: 3.5
typedef void V;
typedef const void CV;
void a(void);
void b(const void);
// expected-error@-1 {{'void' as parameter must not have type qualifiers}}
void c(V);
void d(CV);
// expected-error@-1 {{'void' as parameter must not have type qualifiers}}
void (*e)(void) = c;
void (*f)(const void);
// expected-error@-1 {{'void' as parameter must not have type qualifiers}}
void (*g)(V) = a;
void (*h)(CV);
// expected-error@-1 {{'void' as parameter must not have type qualifiers}}
template<typename T> void i(T); // #cwg577-i
template<typename T> void j(void (*)(T)); // #cwg577-j
void k() {
a();
c();
i<void>();
// expected-error@-1 {{no matching function for call to 'i'}}
// expected-note@#cwg577-i {{candidate function template not viable: requires 1 argument, but 0 were provided}}
i<const void>();
// expected-error@-1 {{no matching function for call to 'i'}}
// expected-note@#cwg577-i {{candidate function template not viable: requires 1 argument, but 0 were provided}}
j<void>(0);
// expected-error@-1 {{no matching function for call to 'j'}}
// expected-note@#cwg577-j {{candidate template ignored: substitution failure [with T = void]: argument may not have 'void' type}}
j<const void>(0);
// expected-error@-1 {{no matching function for call to 'j'}}
// expected-note@#cwg577-j {{candidate template ignored: substitution failure [with T = const void]: argument may not have 'void' type}}
}
}
namespace cwg580 { // cwg580: partial
class C;
struct A { static C c; };
struct B { static C c; };
class C {
C(); // #cwg580-C-ctor
~C(); // #cwg580-C-dtor
typedef int I; // #cwg580-I
template<int> struct X;
template<int> friend struct Y;
template<int> void f();
template<int> friend void g();
friend struct A;
};
template<C::I> struct C::X {};
template<C::I> struct Y {};
template<C::I> struct Z {};
// expected-error@-1 {{'I' is a private member of 'cwg580::C'}}
// expected-note@#cwg580-I {{implicitly declared private here}}
struct C2 {
class X {
struct A;
typedef int I;
friend struct A;
};
class Y {
// FIXME: We incorrectly accept this
// because we think C2::Y::A<...> might
// instantiate to C2::X::A
template<X::I> struct A {};
};
};
template<C::I> void C::f() {}
template<C::I> void g() {}
template<C::I> void h() {}
// expected-error@-1 {{'I' is a private member of 'cwg580::C'}}
// expected-note@#cwg580-I {{implicitly declared private here}}
C A::c;
C B::c; // #cwg580-c
// expected-error@#cwg580-c {{calling a private constructor of class 'cwg580::C'}}
// expected-note@#cwg580-C-ctor {{implicitly declared private here}}
// expected-error@#cwg580-c {{variable of type 'C' has private destructor}}
// expected-note@#cwg580-C-dtor {{implicitly declared private here}}
}
// cwg582: na
namespace cwg583 { // cwg583: 4
// see n3624
int *p;
bool b1 = p < 0;
// expected-error@-1 {{ordered comparison between pointer and zero ('int *' and 'int')}}
bool b2 = p > 0;
// expected-error@-1 {{ordered comparison between pointer and zero ('int *' and 'int')}}
bool b3 = p <= 0;
// expected-error@-1 {{ordered comparison between pointer and zero ('int *' and 'int')}}
bool b4 = p >= 0;
// expected-error@-1 {{ordered comparison between pointer and zero ('int *' and 'int')}}
}
// cwg584: na
namespace cwg585 { // cwg585: 3.0
template<typename> struct T; // #cwg585-struct-T
struct A {
friend T;
// cxx98-14-error@-1 {{a type specifier is required for all declarations}}
// cxx98-14-error@-2 {{friends can only be classes or functions}}
// since-cxx17-error@-3 {{use of class template 'T' requires template arguments; argument deduction not allowed in friend declaration}}
// since-cxx17-note@#cwg585-struct-T {{template is declared here}}
// FIXME: It's not clear whether the standard allows this or what it means,
// but the CWG585 writeup suggests it as an alternative.
template<typename U> friend T<U>;
// expected-error@-1 {{friend type templates must use an elaborated type}}
};
template<template<typename> class T> struct B { // #cwg585-template-T
friend T;
// cxx98-14-error@-1 {{a type specifier is required for all declarations}}
// cxx98-14-error@-2 {{friends can only be classes or functions}}
// since-cxx17-error@-3 {{use of template template parameter 'T' requires template arguments; argument deduction not allowed in friend declaration}}
// since-cxx17-note@#cwg585-template-T {{template is declared here}}
template<typename U> friend T<U>;
// expected-error@-1 {{friend type templates must use an elaborated type}}
};
}
// cwg586: na
namespace cwg587 { // cwg587: 3.2
template<typename T> void f(bool b, const T x, T y) {
const T *p = &(b ? x : y);
}
struct S {};
template void f(bool, const int, int);
template void f(bool, const S, S);
}
namespace cwg588 { // cwg588: yes
struct A { int n; }; // #cwg588-A
template<typename T> int f() {
struct S : A, T { int f() { return n; } } s;
int a = s.f();
int b = s.n;
// expected-error@-1 {{member 'n' found in multiple base classes of different types}}
// expected-note@#cwg588-k {{in instantiation of function template specialization 'cwg588::f<cwg588::B>' requested here}}
// expected-note@#cwg588-A {{member found by ambiguous name lookup}}
// expected-note@#cwg588-B {{member found by ambiguous name lookup}}
}
struct B { int n; }; // #cwg588-B
int k = f<B>(); // #cwg588-k
}
namespace cwg589 { // cwg589: yes
struct B { };
struct D : B { };
D f();
extern const B &b;
bool a;
const B *p = &(a ? f() : b);
// expected-error@-1 {{taking the address of a temporary object of type 'const B'}}
const B *q = &(a ? D() : b);
// expected-error@-1 {{taking the address of a temporary object of type 'const B'}}
}
namespace cwg590 { // cwg590: yes
template<typename T> struct A {
struct B {
struct C {
A<T>::B::C f(A<T>::B::C); // ok, no 'typename' required.
};
};
};
template<typename T> typename A<T>::B::C A<T>::B::C::f(A<T>::B::C) {}
}
namespace cwg591 { // cwg591: no
template<typename T> struct A {
typedef int M;
struct B {
typedef void M;
struct C;
};
};
template<typename T> struct A<T>::B::C : A<T> {
// FIXME: Should find member of non-dependent base class A<T>.
M m;
// expected-error@-1 {{field has incomplete type 'M' (aka 'void'}}
};
}
// cwg592: na
// cwg593 is in cwg593.cpp
// cwg594: na
namespace cwg595 { // cwg595: dup 1330
template<class T> struct X {
void f() throw(T) {}
// since-cxx17-error@-1 {{ISO C++17 does not allow dynamic exception specifications}}
// since-cxx17-note@-2 {{use 'noexcept(false)' instead}}
};
struct S {
X<S> xs;
};
}
// cwg597: na
namespace cwg598 { // cwg598: yes
namespace N {
void f(int);
void f(char);
// Not found by ADL.
void g(void (*)(int));
void h(void (*)(int));
namespace M {
struct S {};
int &h(void (*)(S));
}
void i(M::S);
void i();
}
int &g(void(*)(char));
int &r = g(N::f);
int &s = h(N::f);
// expected-error@-1 {{use of undeclared identifier 'h'}}
int &t = h(N::i);
}
namespace cwg599 { // cwg599: partial
typedef int Fn();
struct S { operator void*(); };
struct T { operator Fn*(); };
struct U { operator int*(); operator void*(); }; // #cwg599-U
struct V { operator int*(); operator Fn*(); };
void f(void *p, void (*q)(), S s, T t, U u, V v) {
delete p;
// cxx98-23-error@-1 {{cannot delete expression with pointer-to-'void' type 'void *'}}
// since-cxx26-error@-2 {{cannot delete pointer to incomplete type 'void'}}
delete q;
// expected-error@-1 {{cannot delete expression of type 'void (*)()'}}
delete s;
// cxx98-23-error@-1 {{cannot delete expression with pointer-to-'void' type 'void *'}}
// since-cxx26-error@-2 {{cannot delete pointer to incomplete type 'void'}}
delete t;
// expected-error@-1 {{cannot delete expression of type 'T'}}
// FIXME: This is valid, but is rejected due to a non-conforming GNU
// extension allowing deletion of pointers to void.
delete u;
// expected-error@-1 {{ambiguous conversion of delete expression of type 'U' to a pointer}}
// expected-note@#cwg599-U {{conversion to pointer type 'int *'}}
// expected-note@#cwg599-U {{conversion to pointer type 'void *'}}
delete v;
}
}
|