1- // RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify %s -std=c++23 -fcxx-type-aware-allocators
2- // RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify %s -std=c++26
3- // RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify %s -DNO_TAA -std=c++23 -fno-cxx-type-aware-allocators
4- // RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify %s -DNO_TAA -std=c++26 -fno-cxx-type-aware-allocators
1+ // RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify=expected,precxx26 %s -std=c++23 -fcxx-type-aware-allocators
2+ // RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify %s -std=c++26
3+ // RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify=expected,precxx26 %s -DNO_TAA -std=c++23 -fno-cxx-type-aware-allocators
4+ // RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify %s -DNO_TAA -std=c++26 -fno-cxx-type-aware-allocators
55
66namespace std {
77 template <class T > struct type_identity {};
@@ -18,6 +18,9 @@ struct S {
1818#if defined(NO_TAA)
1919 // expected-error@#1 {{type aware allocation operators are disabled, enable with '-fcxx-type-aware-allocators'}}
2020 // expected-error@#2 {{type aware allocation operators are disabled, enable with '-fcxx-type-aware-allocators'}}
21+ #else
22+ // precxx26-warning@#1 {{type aware allocators are a C++2c extension}}
23+ // precxx26-warning@#2 {{type aware allocators are a C++2c extension}}
2124#endif
2225 void operator delete (S *, std::destroying_delete_t );
2326};
@@ -28,6 +31,9 @@ template <typename T> struct S2 {
2831#if defined(NO_TAA)
2932 // expected-error@#3 {{type aware allocation operators are disabled, enable with '-fcxx-type-aware-allocators'}}
3033 // expected-error@#4 {{type aware allocation operators are disabled, enable with '-fcxx-type-aware-allocators'}}
34+ #else
35+ // precxx26-warning@#3 {{type aware allocators are a C++2c extension}}
36+ // precxx26-warning@#4 {{type aware allocators are a C++2c extension}}
3137#endif
3238 void operator delete (S2 *, std::destroying_delete_t );
3339};
@@ -38,6 +44,9 @@ struct S3 {
3844#if defined(NO_TAA)
3945 // expected-error@#5 {{type aware allocation operators are disabled, enable with '-fcxx-type-aware-allocators'}}
4046 // expected-error@#6 {{type aware allocation operators are disabled, enable with '-fcxx-type-aware-allocators'}}
47+ #else
48+ // precxx26-warning@#5 {{type aware allocators are a C++2c extension}}
49+ // precxx26-warning@#6 {{type aware allocators are a C++2c extension}}
4150#endif
4251 void operator delete (S3 *, std::destroying_delete_t );
4352};
@@ -51,6 +60,8 @@ struct S4 {
5160 // expected-error@#8 {{type aware allocation operators are disabled, enable with '-fcxx-type-aware-allocators'}}
5261 // expected-error@#9 {{type aware destroying delete is not permitted in C++26}}
5362#else
63+ // precxx26-warning@#7 {{type aware allocators are a C++2c extension}}
64+ // precxx26-warning@#8 {{type aware allocators are a C++2c extension}}
5465 // expected-error@#9 {{type aware destroying delete is not permitted in C++26}}
5566#endif
5667};
@@ -65,6 +76,7 @@ struct S5 {
6576 // expected-error@#10 {{type aware allocation operators are disabled, enable with '-fcxx-type-aware-allocators'}}
6677#else
6778 // expected-error@#10 {{type aware 'operator delete' cannot take a dependent type as its second parameter}}
79+ // precxx26-warning@#10 {{type aware allocators are a C++2c extension}}
6880#endif
6981};
7082
@@ -74,12 +86,14 @@ struct S6 {
7486 // expected-error@#11 {{type aware allocation operators are disabled, enable with '-fcxx-type-aware-allocators'}}
7587#else
7688 // expected-error@#11 {{type aware 'operator new' cannot take a dependent type as its second parameter}}
89+ // precxx26-warning@#11 {{type aware allocators are a C++2c extension}}
7790#endif
7891 template <typename T> void operator delete (std::type_identity<S6>, T, size_t , std::align_val_t ); // #12
7992#if defined(NO_TAA)
8093 // expected-error@#12 {{type aware allocation operators are disabled, enable with '-fcxx-type-aware-allocators'}}
8194#else
8295 // expected-error@#12 {{type aware 'operator delete' cannot take a dependent type as its second parameter}}
96+ // precxx26-warning@#12 {{type aware allocators are a C++2c extension}}
8397#endif
8498};
8599
@@ -88,8 +102,10 @@ template <typename U>
88102struct S7 {
89103 template <typename T> void *operator new (std::type_identity<T>, U, std::align_val_t ); // #13
90104 // expected-error@#13 {{type aware 'operator new' cannot take a dependent type as its second parameter;}}
105+ // precxx26-warning@#13 {{type aware allocators are a C++2c extension}}
91106 template <typename T> void operator delete (std::type_identity<T>, U, size_t , std::align_val_t ); // #14
92107 // expected-error@#14 {{type aware 'operator delete' cannot take a dependent type as its second parameter;}}
108+ // precxx26-warning@#14 {{type aware allocators are a C++2c extension}}
93109 template <typename T> void operator delete (std::type_identity<T>, S7 *, std::destroying_delete_t , U, std::align_val_t ); // #15
94110 // expected-error@#15 {{type aware destroying delete is not permitted in C++26}}
95111 void operator delete (S7 *, std::destroying_delete_t , U); // #16
@@ -104,8 +120,10 @@ void f() {
104120struct S8 {
105121 template <typename T, typename U> void *operator new (std::type_identity<T>, U, std::align_val_t ); // #17
106122 // expected-error@#17 {{type aware 'operator new' cannot take a dependent type as its second parameter;}}
123+ // precxx26-warning@#17 {{type aware allocators are a C++2c extension}}
107124 template <typename T, typename U> void operator delete (std::type_identity<T>, U, size_t , std::align_val_t ); // #18
108125 // expected-error@#18 {{type aware 'operator delete' cannot take a dependent type as its second parameter;}}
126+ // precxx26-warning@#18 {{type aware allocators are a C++2c extension}}
109127 template <typename T, typename U> void operator delete (std::type_identity<T>, S8 *, std::destroying_delete_t , U, std::align_val_t ); // #19
110128 // expected-error@#19 {{type aware destroying delete is not permitted in C++26}}
111129};
@@ -116,16 +134,24 @@ typedef std::type_identity<double> TypedefAlias;
116134using UsingAlias = std::type_identity<float >;
117135struct S9 {
118136 void *operator new (Alias<size_t >, std::align_val_t );
119- template <typename T> void *operator new (Alias<std::type_identity<T>>, Alias<size_t >, std::align_val_t );
137+ template <typename T> void *operator new (Alias<std::type_identity<T>>, Alias<size_t >, std::align_val_t ); // #20
138+ // precxx26-warning@#20 {{type aware allocators are a C++2c extension}}
120139 void *operator new (Alias<std::type_identity<int >>, size_t , std::align_val_t );
121- template <typename T> void operator delete (Alias<std::type_identity<T>>, void *, size_t , std::align_val_t );
140+ // precxx26-warning@-1 {{type aware allocators are a C++2c extension}}
141+ template <typename T> void operator delete (Alias<std::type_identity<T>>, void *, size_t , std::align_val_t ); // #21
142+ // precxx26-warning@#21{{type aware allocators are a C++2c extension}}
122143 void operator delete (Alias<std::type_identity<int >>, void *, size_t , std::align_val_t );
144+ // precxx26-warning@-1 {{type aware allocators are a C++2c extension}}
123145};
124146struct S10 {
125- template <typename T> void *operator new (TypeIdentityAlias<T>, size_t , std::align_val_t );
147+ template <typename T> void *operator new (TypeIdentityAlias<T>, size_t , std::align_val_t ); // #22
148+ // precxx26-warning@#22 {{type aware allocators are a C++2c extension}}
126149 void *operator new (TypeIdentityAlias<int >, size_t , std::align_val_t );
127- template <typename T> void operator delete (TypeIdentityAlias<T>, void *, size_t , std::align_val_t );
150+ // precxx26-warning@-1 {{type aware allocators are a C++2c extension}}
151+ template <typename T> void operator delete (TypeIdentityAlias<T>, void *, size_t , std::align_val_t ); // #23
152+ // precxx26-warning@-1 {{type aware allocators are a C++2c extension}}
128153 void operator delete (TypeIdentityAlias<int >, void *, size_t , std::align_val_t );
154+ // precxx26-warning@-1 {{type aware allocators are a C++2c extension}}
129155};
130156
131157void test () {
@@ -137,20 +163,30 @@ void test() {
137163
138164struct S11 {
139165 template <typename T> void *operator new (TypedefAlias, size_t , std::align_val_t );
166+ // precxx26-warning@-1 {{type aware allocators are a C++2c extension}}
140167 void *operator new (TypedefAlias, size_t , std::align_val_t );
168+ // precxx26-warning@-1 {{type aware allocators are a C++2c extension}}
141169 template <typename T> void operator delete (TypedefAlias, void *, size_t , std::align_val_t );
170+ // precxx26-warning@-1 {{type aware allocators are a C++2c extension}}
142171 void operator delete (TypedefAlias, void *, size_t , std::align_val_t );
172+ // precxx26-warning@-1 {{type aware allocators are a C++2c extension}}
143173};
144174struct S12 {
145175 template <typename T> void *operator new (UsingAlias, size_t , std::align_val_t );
176+ // precxx26-warning@-1 {{type aware allocators are a C++2c extension}}
146177 void *operator new (UsingAlias, size_t , std::align_val_t );
178+ // precxx26-warning@-1 {{type aware allocators are a C++2c extension}}
147179 template <typename T> void operator delete (UsingAlias, void *, size_t , std::align_val_t );
180+ // precxx26-warning@-1 {{type aware allocators are a C++2c extension}}
148181 void operator delete (UsingAlias, void *, size_t , std::align_val_t );
182+ // precxx26-warning@-1 {{type aware allocators are a C++2c extension}}
149183};
150184
151185struct S13 {
152186 void *operator new (std::type_identity<S13>, size_t , std::align_val_t );
187+ // precxx26-warning@-1 {{type aware allocators are a C++2c extension}}
153188 void operator delete (std::type_identity<S13>, void *, size_t , std::align_val_t );
189+ // precxx26-warning@-1 {{type aware allocators are a C++2c extension}}
154190};
155191
156192#endif
0 commit comments