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