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

source code of libcxx/test/std/language.support/support.limits/support.limits.general/string.version.compile.pass.cpp