1 | //===----------------------------------------------------------------------===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | // |
9 | // WARNING: This test was generated by generate_feature_test_macro_components.py |
10 | // and should not be edited manually. |
11 | // |
12 | // clang-format off |
13 | |
14 | // <string> |
15 | |
16 | // Test the feature test macros defined by <string> |
17 | |
18 | /* Constant Value |
19 | __cpp_lib_allocator_traits_is_always_equal 201411L [C++17] |
20 | __cpp_lib_char8_t 201907L [C++20] |
21 | __cpp_lib_constexpr_string 201907L [C++20] |
22 | __cpp_lib_default_template_type_for_algorithm_values 202403L [C++26] |
23 | __cpp_lib_erase_if 202002L [C++20] |
24 | __cpp_lib_nonmember_container_access 201411L [C++17] |
25 | __cpp_lib_ranges_to_container 202202L [C++23] |
26 | __cpp_lib_starts_ends_with 201711L [C++20] |
27 | __cpp_lib_string_contains 202011L [C++23] |
28 | __cpp_lib_string_resize_and_overwrite 202110L [C++23] |
29 | __cpp_lib_string_udls 201304L [C++14] |
30 | __cpp_lib_string_view 201606L [C++17] |
31 | 201803L [C++20] |
32 | __cpp_lib_to_string 202306L [C++23] |
33 | */ |
34 | |
35 | #include <string> |
36 | #include "test_macros.h" |
37 | |
38 | #if TEST_STD_VER < 14 |
39 | |
40 | # ifdef __cpp_lib_allocator_traits_is_always_equal |
41 | # error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17" |
42 | # endif |
43 | |
44 | # ifdef __cpp_lib_char8_t |
45 | # error "__cpp_lib_char8_t should not be defined before c++20" |
46 | # endif |
47 | |
48 | # ifdef __cpp_lib_constexpr_string |
49 | # error "__cpp_lib_constexpr_string should not be defined before c++20" |
50 | # endif |
51 | |
52 | # ifdef __cpp_lib_default_template_type_for_algorithm_values |
53 | # error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26" |
54 | # endif |
55 | |
56 | # ifdef __cpp_lib_erase_if |
57 | # error "__cpp_lib_erase_if should not be defined before c++20" |
58 | # endif |
59 | |
60 | # ifdef __cpp_lib_nonmember_container_access |
61 | # error "__cpp_lib_nonmember_container_access should not be defined before c++17" |
62 | # endif |
63 | |
64 | # ifdef __cpp_lib_ranges_to_container |
65 | # error "__cpp_lib_ranges_to_container should not be defined before c++23" |
66 | # endif |
67 | |
68 | # ifdef __cpp_lib_starts_ends_with |
69 | # error "__cpp_lib_starts_ends_with should not be defined before c++20" |
70 | # endif |
71 | |
72 | # ifdef __cpp_lib_string_contains |
73 | # error "__cpp_lib_string_contains should not be defined before c++23" |
74 | # endif |
75 | |
76 | # ifdef __cpp_lib_string_resize_and_overwrite |
77 | # error "__cpp_lib_string_resize_and_overwrite should not be defined before c++23" |
78 | # endif |
79 | |
80 | # ifdef __cpp_lib_string_udls |
81 | # error "__cpp_lib_string_udls should not be defined before c++14" |
82 | # endif |
83 | |
84 | # ifdef __cpp_lib_string_view |
85 | # error "__cpp_lib_string_view should not be defined before c++17" |
86 | # endif |
87 | |
88 | # ifdef __cpp_lib_to_string |
89 | # error "__cpp_lib_to_string should not be defined before c++23" |
90 | # endif |
91 | |
92 | #elif TEST_STD_VER == 14 |
93 | |
94 | # ifdef __cpp_lib_allocator_traits_is_always_equal |
95 | # error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17" |
96 | # endif |
97 | |
98 | # ifdef __cpp_lib_char8_t |
99 | # error "__cpp_lib_char8_t should not be defined before c++20" |
100 | # endif |
101 | |
102 | # ifdef __cpp_lib_constexpr_string |
103 | # error "__cpp_lib_constexpr_string should not be defined before c++20" |
104 | # endif |
105 | |
106 | # ifdef __cpp_lib_default_template_type_for_algorithm_values |
107 | # error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26" |
108 | # endif |
109 | |
110 | # ifdef __cpp_lib_erase_if |
111 | # error "__cpp_lib_erase_if should not be defined before c++20" |
112 | # endif |
113 | |
114 | # ifdef __cpp_lib_nonmember_container_access |
115 | # error "__cpp_lib_nonmember_container_access should not be defined before c++17" |
116 | # endif |
117 | |
118 | # ifdef __cpp_lib_ranges_to_container |
119 | # error "__cpp_lib_ranges_to_container should not be defined before c++23" |
120 | # endif |
121 | |
122 | # ifdef __cpp_lib_starts_ends_with |
123 | # error "__cpp_lib_starts_ends_with should not be defined before c++20" |
124 | # endif |
125 | |
126 | # ifdef __cpp_lib_string_contains |
127 | # error "__cpp_lib_string_contains should not be defined before c++23" |
128 | # endif |
129 | |
130 | # ifdef __cpp_lib_string_resize_and_overwrite |
131 | # error "__cpp_lib_string_resize_and_overwrite should not be defined before c++23" |
132 | # endif |
133 | |
134 | # ifndef __cpp_lib_string_udls |
135 | # error "__cpp_lib_string_udls should be defined in c++14" |
136 | # endif |
137 | # if __cpp_lib_string_udls != 201304L |
138 | # error "__cpp_lib_string_udls should have the value 201304L in c++14" |
139 | # endif |
140 | |
141 | # ifdef __cpp_lib_string_view |
142 | # error "__cpp_lib_string_view should not be defined before c++17" |
143 | # endif |
144 | |
145 | # ifdef __cpp_lib_to_string |
146 | # error "__cpp_lib_to_string should not be defined before c++23" |
147 | # endif |
148 | |
149 | #elif TEST_STD_VER == 17 |
150 | |
151 | # ifndef __cpp_lib_allocator_traits_is_always_equal |
152 | # error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17" |
153 | # endif |
154 | # if __cpp_lib_allocator_traits_is_always_equal != 201411L |
155 | # error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17" |
156 | # endif |
157 | |
158 | # ifdef __cpp_lib_char8_t |
159 | # error "__cpp_lib_char8_t should not be defined before c++20" |
160 | # endif |
161 | |
162 | # ifdef __cpp_lib_constexpr_string |
163 | # error "__cpp_lib_constexpr_string should not be defined before c++20" |
164 | # endif |
165 | |
166 | # ifdef __cpp_lib_default_template_type_for_algorithm_values |
167 | # error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26" |
168 | # endif |
169 | |
170 | # ifdef __cpp_lib_erase_if |
171 | # error "__cpp_lib_erase_if should not be defined before c++20" |
172 | # endif |
173 | |
174 | # ifndef __cpp_lib_nonmember_container_access |
175 | # error "__cpp_lib_nonmember_container_access should be defined in c++17" |
176 | # endif |
177 | # if __cpp_lib_nonmember_container_access != 201411L |
178 | # error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17" |
179 | # endif |
180 | |
181 | # ifdef __cpp_lib_ranges_to_container |
182 | # error "__cpp_lib_ranges_to_container should not be defined before c++23" |
183 | # endif |
184 | |
185 | # ifdef __cpp_lib_starts_ends_with |
186 | # error "__cpp_lib_starts_ends_with should not be defined before c++20" |
187 | # endif |
188 | |
189 | # ifdef __cpp_lib_string_contains |
190 | # error "__cpp_lib_string_contains should not be defined before c++23" |
191 | # endif |
192 | |
193 | # ifdef __cpp_lib_string_resize_and_overwrite |
194 | # error "__cpp_lib_string_resize_and_overwrite should not be defined before c++23" |
195 | # endif |
196 | |
197 | # ifndef __cpp_lib_string_udls |
198 | # error "__cpp_lib_string_udls should be defined in c++17" |
199 | # endif |
200 | # if __cpp_lib_string_udls != 201304L |
201 | # error "__cpp_lib_string_udls should have the value 201304L in c++17" |
202 | # endif |
203 | |
204 | # ifndef __cpp_lib_string_view |
205 | # error "__cpp_lib_string_view should be defined in c++17" |
206 | # endif |
207 | # if __cpp_lib_string_view != 201606L |
208 | # error "__cpp_lib_string_view should have the value 201606L in c++17" |
209 | # endif |
210 | |
211 | # ifdef __cpp_lib_to_string |
212 | # error "__cpp_lib_to_string should not be defined before c++23" |
213 | # endif |
214 | |
215 | #elif TEST_STD_VER == 20 |
216 | |
217 | # ifndef __cpp_lib_allocator_traits_is_always_equal |
218 | # error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++20" |
219 | # endif |
220 | # if __cpp_lib_allocator_traits_is_always_equal != 201411L |
221 | # error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++20" |
222 | # endif |
223 | |
224 | # if defined(__cpp_char8_t) |
225 | # ifndef __cpp_lib_char8_t |
226 | # error "__cpp_lib_char8_t should be defined in c++20" |
227 | # endif |
228 | # if __cpp_lib_char8_t != 201907L |
229 | # error "__cpp_lib_char8_t should have the value 201907L in c++20" |
230 | # endif |
231 | # else |
232 | # ifdef __cpp_lib_char8_t |
233 | # error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!" |
234 | # endif |
235 | # endif |
236 | |
237 | # ifndef __cpp_lib_constexpr_string |
238 | # error "__cpp_lib_constexpr_string should be defined in c++20" |
239 | # endif |
240 | # if __cpp_lib_constexpr_string != 201907L |
241 | # error "__cpp_lib_constexpr_string should have the value 201907L in c++20" |
242 | # endif |
243 | |
244 | # ifdef __cpp_lib_default_template_type_for_algorithm_values |
245 | # error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26" |
246 | # endif |
247 | |
248 | # ifndef __cpp_lib_erase_if |
249 | # error "__cpp_lib_erase_if should be defined in c++20" |
250 | # endif |
251 | # if __cpp_lib_erase_if != 202002L |
252 | # error "__cpp_lib_erase_if should have the value 202002L in c++20" |
253 | # endif |
254 | |
255 | # ifndef __cpp_lib_nonmember_container_access |
256 | # error "__cpp_lib_nonmember_container_access should be defined in c++20" |
257 | # endif |
258 | # if __cpp_lib_nonmember_container_access != 201411L |
259 | # error "__cpp_lib_nonmember_container_access should have the value 201411L in c++20" |
260 | # endif |
261 | |
262 | # ifdef __cpp_lib_ranges_to_container |
263 | # error "__cpp_lib_ranges_to_container should not be defined before c++23" |
264 | # endif |
265 | |
266 | # ifndef __cpp_lib_starts_ends_with |
267 | # error "__cpp_lib_starts_ends_with should be defined in c++20" |
268 | # endif |
269 | # if __cpp_lib_starts_ends_with != 201711L |
270 | # error "__cpp_lib_starts_ends_with should have the value 201711L in c++20" |
271 | # endif |
272 | |
273 | # ifdef __cpp_lib_string_contains |
274 | # error "__cpp_lib_string_contains should not be defined before c++23" |
275 | # endif |
276 | |
277 | # ifdef __cpp_lib_string_resize_and_overwrite |
278 | # error "__cpp_lib_string_resize_and_overwrite should not be defined before c++23" |
279 | # endif |
280 | |
281 | # ifndef __cpp_lib_string_udls |
282 | # error "__cpp_lib_string_udls should be defined in c++20" |
283 | # endif |
284 | # if __cpp_lib_string_udls != 201304L |
285 | # error "__cpp_lib_string_udls should have the value 201304L in c++20" |
286 | # endif |
287 | |
288 | # ifndef __cpp_lib_string_view |
289 | # error "__cpp_lib_string_view should be defined in c++20" |
290 | # endif |
291 | # if __cpp_lib_string_view != 201803L |
292 | # error "__cpp_lib_string_view should have the value 201803L in c++20" |
293 | # endif |
294 | |
295 | # ifdef __cpp_lib_to_string |
296 | # error "__cpp_lib_to_string should not be defined before c++23" |
297 | # endif |
298 | |
299 | #elif TEST_STD_VER == 23 |
300 | |
301 | # ifndef __cpp_lib_allocator_traits_is_always_equal |
302 | # error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++23" |
303 | # endif |
304 | # if __cpp_lib_allocator_traits_is_always_equal != 201411L |
305 | # error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++23" |
306 | # endif |
307 | |
308 | # if defined(__cpp_char8_t) |
309 | # ifndef __cpp_lib_char8_t |
310 | # error "__cpp_lib_char8_t should be defined in c++23" |
311 | # endif |
312 | # if __cpp_lib_char8_t != 201907L |
313 | # error "__cpp_lib_char8_t should have the value 201907L in c++23" |
314 | # endif |
315 | # else |
316 | # ifdef __cpp_lib_char8_t |
317 | # error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!" |
318 | # endif |
319 | # endif |
320 | |
321 | # ifndef __cpp_lib_constexpr_string |
322 | # error "__cpp_lib_constexpr_string should be defined in c++23" |
323 | # endif |
324 | # if __cpp_lib_constexpr_string != 201907L |
325 | # error "__cpp_lib_constexpr_string should have the value 201907L in c++23" |
326 | # endif |
327 | |
328 | # ifdef __cpp_lib_default_template_type_for_algorithm_values |
329 | # error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26" |
330 | # endif |
331 | |
332 | # ifndef __cpp_lib_erase_if |
333 | # error "__cpp_lib_erase_if should be defined in c++23" |
334 | # endif |
335 | # if __cpp_lib_erase_if != 202002L |
336 | # error "__cpp_lib_erase_if should have the value 202002L in c++23" |
337 | # endif |
338 | |
339 | # ifndef __cpp_lib_nonmember_container_access |
340 | # error "__cpp_lib_nonmember_container_access should be defined in c++23" |
341 | # endif |
342 | # if __cpp_lib_nonmember_container_access != 201411L |
343 | # error "__cpp_lib_nonmember_container_access should have the value 201411L in c++23" |
344 | # endif |
345 | |
346 | # ifndef __cpp_lib_ranges_to_container |
347 | # error "__cpp_lib_ranges_to_container should be defined in c++23" |
348 | # endif |
349 | # if __cpp_lib_ranges_to_container != 202202L |
350 | # error "__cpp_lib_ranges_to_container should have the value 202202L in c++23" |
351 | # endif |
352 | |
353 | # ifndef __cpp_lib_starts_ends_with |
354 | # error "__cpp_lib_starts_ends_with should be defined in c++23" |
355 | # endif |
356 | # if __cpp_lib_starts_ends_with != 201711L |
357 | # error "__cpp_lib_starts_ends_with should have the value 201711L in c++23" |
358 | # endif |
359 | |
360 | # ifndef __cpp_lib_string_contains |
361 | # error "__cpp_lib_string_contains should be defined in c++23" |
362 | # endif |
363 | # if __cpp_lib_string_contains != 202011L |
364 | # error "__cpp_lib_string_contains should have the value 202011L in c++23" |
365 | # endif |
366 | |
367 | # ifndef __cpp_lib_string_resize_and_overwrite |
368 | # error "__cpp_lib_string_resize_and_overwrite should be defined in c++23" |
369 | # endif |
370 | # if __cpp_lib_string_resize_and_overwrite != 202110L |
371 | # error "__cpp_lib_string_resize_and_overwrite should have the value 202110L in c++23" |
372 | # endif |
373 | |
374 | # ifndef __cpp_lib_string_udls |
375 | # error "__cpp_lib_string_udls should be defined in c++23" |
376 | # endif |
377 | # if __cpp_lib_string_udls != 201304L |
378 | # error "__cpp_lib_string_udls should have the value 201304L in c++23" |
379 | # endif |
380 | |
381 | # ifndef __cpp_lib_string_view |
382 | # error "__cpp_lib_string_view should be defined in c++23" |
383 | # endif |
384 | # if __cpp_lib_string_view != 201803L |
385 | # error "__cpp_lib_string_view should have the value 201803L in c++23" |
386 | # endif |
387 | |
388 | # if !defined(_LIBCPP_VERSION) |
389 | # ifndef __cpp_lib_to_string |
390 | # error "__cpp_lib_to_string should be defined in c++23" |
391 | # endif |
392 | # if __cpp_lib_to_string != 202306L |
393 | # error "__cpp_lib_to_string should have the value 202306L in c++23" |
394 | # endif |
395 | # else // _LIBCPP_VERSION |
396 | # ifdef __cpp_lib_to_string |
397 | # error "__cpp_lib_to_string should not be defined because it is unimplemented in libc++!" |
398 | # endif |
399 | # endif |
400 | |
401 | #elif TEST_STD_VER > 23 |
402 | |
403 | # ifndef __cpp_lib_allocator_traits_is_always_equal |
404 | # error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++26" |
405 | # endif |
406 | # if __cpp_lib_allocator_traits_is_always_equal != 201411L |
407 | # error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++26" |
408 | # endif |
409 | |
410 | # if defined(__cpp_char8_t) |
411 | # ifndef __cpp_lib_char8_t |
412 | # error "__cpp_lib_char8_t should be defined in c++26" |
413 | # endif |
414 | # if __cpp_lib_char8_t != 201907L |
415 | # error "__cpp_lib_char8_t should have the value 201907L in c++26" |
416 | # endif |
417 | # else |
418 | # ifdef __cpp_lib_char8_t |
419 | # error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!" |
420 | # endif |
421 | # endif |
422 | |
423 | # ifndef __cpp_lib_constexpr_string |
424 | # error "__cpp_lib_constexpr_string should be defined in c++26" |
425 | # endif |
426 | # if __cpp_lib_constexpr_string != 201907L |
427 | # error "__cpp_lib_constexpr_string should have the value 201907L in c++26" |
428 | # endif |
429 | |
430 | # if !defined(_LIBCPP_VERSION) |
431 | # ifndef __cpp_lib_default_template_type_for_algorithm_values |
432 | # error "__cpp_lib_default_template_type_for_algorithm_values should be defined in c++26" |
433 | # endif |
434 | # if __cpp_lib_default_template_type_for_algorithm_values != 202403L |
435 | # error "__cpp_lib_default_template_type_for_algorithm_values should have the value 202403L in c++26" |
436 | # endif |
437 | # else // _LIBCPP_VERSION |
438 | # ifdef __cpp_lib_default_template_type_for_algorithm_values |
439 | # error "__cpp_lib_default_template_type_for_algorithm_values should not be defined because it is unimplemented in libc++!" |
440 | # endif |
441 | # endif |
442 | |
443 | # ifndef __cpp_lib_erase_if |
444 | # error "__cpp_lib_erase_if should be defined in c++26" |
445 | # endif |
446 | # if __cpp_lib_erase_if != 202002L |
447 | # error "__cpp_lib_erase_if should have the value 202002L in c++26" |
448 | # endif |
449 | |
450 | # ifndef __cpp_lib_nonmember_container_access |
451 | # error "__cpp_lib_nonmember_container_access should be defined in c++26" |
452 | # endif |
453 | # if __cpp_lib_nonmember_container_access != 201411L |
454 | # error "__cpp_lib_nonmember_container_access should have the value 201411L in c++26" |
455 | # endif |
456 | |
457 | # ifndef __cpp_lib_ranges_to_container |
458 | # error "__cpp_lib_ranges_to_container should be defined in c++26" |
459 | # endif |
460 | # if __cpp_lib_ranges_to_container != 202202L |
461 | # error "__cpp_lib_ranges_to_container should have the value 202202L in c++26" |
462 | # endif |
463 | |
464 | # ifndef __cpp_lib_starts_ends_with |
465 | # error "__cpp_lib_starts_ends_with should be defined in c++26" |
466 | # endif |
467 | # if __cpp_lib_starts_ends_with != 201711L |
468 | # error "__cpp_lib_starts_ends_with should have the value 201711L in c++26" |
469 | # endif |
470 | |
471 | # ifndef __cpp_lib_string_contains |
472 | # error "__cpp_lib_string_contains should be defined in c++26" |
473 | # endif |
474 | # if __cpp_lib_string_contains != 202011L |
475 | # error "__cpp_lib_string_contains should have the value 202011L in c++26" |
476 | # endif |
477 | |
478 | # ifndef __cpp_lib_string_resize_and_overwrite |
479 | # error "__cpp_lib_string_resize_and_overwrite should be defined in c++26" |
480 | # endif |
481 | # if __cpp_lib_string_resize_and_overwrite != 202110L |
482 | # error "__cpp_lib_string_resize_and_overwrite should have the value 202110L in c++26" |
483 | # endif |
484 | |
485 | # ifndef __cpp_lib_string_udls |
486 | # error "__cpp_lib_string_udls should be defined in c++26" |
487 | # endif |
488 | # if __cpp_lib_string_udls != 201304L |
489 | # error "__cpp_lib_string_udls should have the value 201304L in c++26" |
490 | # endif |
491 | |
492 | # ifndef __cpp_lib_string_view |
493 | # error "__cpp_lib_string_view should be defined in c++26" |
494 | # endif |
495 | # if __cpp_lib_string_view != 201803L |
496 | # error "__cpp_lib_string_view should have the value 201803L in c++26" |
497 | # endif |
498 | |
499 | # if !defined(_LIBCPP_VERSION) |
500 | # ifndef __cpp_lib_to_string |
501 | # error "__cpp_lib_to_string should be defined in c++26" |
502 | # endif |
503 | # if __cpp_lib_to_string != 202306L |
504 | # error "__cpp_lib_to_string should have the value 202306L in c++26" |
505 | # endif |
506 | # else // _LIBCPP_VERSION |
507 | # ifdef __cpp_lib_to_string |
508 | # error "__cpp_lib_to_string should not be defined because it is unimplemented in libc++!" |
509 | # endif |
510 | # endif |
511 | |
512 | #endif // TEST_STD_VER > 23 |
513 | |
514 | |