1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // WARNING: This test was generated by generate_feature_test_macro_components.py
10 // and should not be edited manually.
16 // Test the feature test macros defined by <algorithm>
19 __cpp_lib_clamp 201603L [C++17]
20 __cpp_lib_constexpr_algorithms 201806L [C++20]
21 __cpp_lib_default_template_type_for_algorithm_values 202403L [C++26]
22 __cpp_lib_freestanding_algorithm 202311L [C++26]
23 __cpp_lib_parallel_algorithm 201603L [C++17]
24 __cpp_lib_ranges 202207L [C++20]
26 __cpp_lib_ranges_contains 202207L [C++23]
27 __cpp_lib_ranges_find_last 202207L [C++23]
28 __cpp_lib_ranges_starts_ends_with 202106L [C++23]
29 __cpp_lib_robust_nonmodifying_seq_ops 201304L [C++14]
30 __cpp_lib_sample 201603L [C++17]
31 __cpp_lib_shift 201806L [C++20]
35 #include "test_macros.h"
39 # ifdef __cpp_lib_clamp
40 # error "__cpp_lib_clamp should not be defined before c++17"
43 # ifdef __cpp_lib_constexpr_algorithms
44 # error "__cpp_lib_constexpr_algorithms should not be defined before c++20"
47 # ifdef __cpp_lib_default_template_type_for_algorithm_values
48 # error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"
51 # ifdef __cpp_lib_freestanding_algorithm
52 # error "__cpp_lib_freestanding_algorithm should not be defined before c++26"
55 # ifdef __cpp_lib_parallel_algorithm
56 # error "__cpp_lib_parallel_algorithm should not be defined before c++17"
59 # ifdef __cpp_lib_ranges
60 # error "__cpp_lib_ranges should not be defined before c++20"
63 # ifdef __cpp_lib_ranges_contains
64 # error "__cpp_lib_ranges_contains should not be defined before c++23"
67 # ifdef __cpp_lib_ranges_find_last
68 # error "__cpp_lib_ranges_find_last should not be defined before c++23"
71 # ifdef __cpp_lib_ranges_starts_ends_with
72 # error "__cpp_lib_ranges_starts_ends_with should not be defined before c++23"
75 # ifdef __cpp_lib_robust_nonmodifying_seq_ops
76 # error "__cpp_lib_robust_nonmodifying_seq_ops should not be defined before c++14"
79 # ifdef __cpp_lib_sample
80 # error "__cpp_lib_sample should not be defined before c++17"
83 # ifdef __cpp_lib_shift
84 # error "__cpp_lib_shift should not be defined before c++20"
87 #elif TEST_STD_VER == 14
89 # ifdef __cpp_lib_clamp
90 # error "__cpp_lib_clamp should not be defined before c++17"
93 # ifdef __cpp_lib_constexpr_algorithms
94 # error "__cpp_lib_constexpr_algorithms should not be defined before c++20"
97 # ifdef __cpp_lib_default_template_type_for_algorithm_values
98 # error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"
101 # ifdef __cpp_lib_freestanding_algorithm
102 # error "__cpp_lib_freestanding_algorithm should not be defined before c++26"
105 # ifdef __cpp_lib_parallel_algorithm
106 # error "__cpp_lib_parallel_algorithm should not be defined before c++17"
109 # ifdef __cpp_lib_ranges
110 # error "__cpp_lib_ranges should not be defined before c++20"
113 # ifdef __cpp_lib_ranges_contains
114 # error "__cpp_lib_ranges_contains should not be defined before c++23"
117 # ifdef __cpp_lib_ranges_find_last
118 # error "__cpp_lib_ranges_find_last should not be defined before c++23"
121 # ifdef __cpp_lib_ranges_starts_ends_with
122 # error "__cpp_lib_ranges_starts_ends_with should not be defined before c++23"
125 # ifndef __cpp_lib_robust_nonmodifying_seq_ops
126 # error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++14"
128 # if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
129 # error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++14"
132 # ifdef __cpp_lib_sample
133 # error "__cpp_lib_sample should not be defined before c++17"
136 # ifdef __cpp_lib_shift
137 # error "__cpp_lib_shift should not be defined before c++20"
140 #elif TEST_STD_VER == 17
142 # ifndef __cpp_lib_clamp
143 # error "__cpp_lib_clamp should be defined in c++17"
145 # if __cpp_lib_clamp != 201603L
146 # error "__cpp_lib_clamp should have the value 201603L in c++17"
149 # ifdef __cpp_lib_constexpr_algorithms
150 # error "__cpp_lib_constexpr_algorithms should not be defined before c++20"
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"
157 # ifdef __cpp_lib_freestanding_algorithm
158 # error "__cpp_lib_freestanding_algorithm should not be defined before c++26"
161 # if !defined(_LIBCPP_VERSION)
162 # ifndef __cpp_lib_parallel_algorithm
163 # error "__cpp_lib_parallel_algorithm should be defined in c++17"
165 # if __cpp_lib_parallel_algorithm != 201603L
166 # error "__cpp_lib_parallel_algorithm should have the value 201603L in c++17"
168 # else // _LIBCPP_VERSION
169 # ifdef __cpp_lib_parallel_algorithm
170 # error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
174 # ifdef __cpp_lib_ranges
175 # error "__cpp_lib_ranges should not be defined before c++20"
178 # ifdef __cpp_lib_ranges_contains
179 # error "__cpp_lib_ranges_contains should not be defined before c++23"
182 # ifdef __cpp_lib_ranges_find_last
183 # error "__cpp_lib_ranges_find_last should not be defined before c++23"
186 # ifdef __cpp_lib_ranges_starts_ends_with
187 # error "__cpp_lib_ranges_starts_ends_with should not be defined before c++23"
190 # ifndef __cpp_lib_robust_nonmodifying_seq_ops
191 # error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++17"
193 # if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
194 # error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++17"
197 # ifndef __cpp_lib_sample
198 # error "__cpp_lib_sample should be defined in c++17"
200 # if __cpp_lib_sample != 201603L
201 # error "__cpp_lib_sample should have the value 201603L in c++17"
204 # ifdef __cpp_lib_shift
205 # error "__cpp_lib_shift should not be defined before c++20"
208 #elif TEST_STD_VER == 20
210 # ifndef __cpp_lib_clamp
211 # error "__cpp_lib_clamp should be defined in c++20"
213 # if __cpp_lib_clamp != 201603L
214 # error "__cpp_lib_clamp should have the value 201603L in c++20"
217 # ifndef __cpp_lib_constexpr_algorithms
218 # error "__cpp_lib_constexpr_algorithms should be defined in c++20"
220 # if __cpp_lib_constexpr_algorithms != 201806L
221 # error "__cpp_lib_constexpr_algorithms should have the value 201806L in c++20"
224 # ifdef __cpp_lib_default_template_type_for_algorithm_values
225 # error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"
228 # ifdef __cpp_lib_freestanding_algorithm
229 # error "__cpp_lib_freestanding_algorithm should not be defined before c++26"
232 # if !defined(_LIBCPP_VERSION)
233 # ifndef __cpp_lib_parallel_algorithm
234 # error "__cpp_lib_parallel_algorithm should be defined in c++20"
236 # if __cpp_lib_parallel_algorithm != 201603L
237 # error "__cpp_lib_parallel_algorithm should have the value 201603L in c++20"
239 # else // _LIBCPP_VERSION
240 # ifdef __cpp_lib_parallel_algorithm
241 # error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
245 # ifndef __cpp_lib_ranges
246 # error "__cpp_lib_ranges should be defined in c++20"
248 # if __cpp_lib_ranges != 202207L
249 # error "__cpp_lib_ranges should have the value 202207L in c++20"
252 # ifdef __cpp_lib_ranges_contains
253 # error "__cpp_lib_ranges_contains should not be defined before c++23"
256 # ifdef __cpp_lib_ranges_find_last
257 # error "__cpp_lib_ranges_find_last should not be defined before c++23"
260 # ifdef __cpp_lib_ranges_starts_ends_with
261 # error "__cpp_lib_ranges_starts_ends_with should not be defined before c++23"
264 # ifndef __cpp_lib_robust_nonmodifying_seq_ops
265 # error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++20"
267 # if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
268 # error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++20"
271 # ifndef __cpp_lib_sample
272 # error "__cpp_lib_sample should be defined in c++20"
274 # if __cpp_lib_sample != 201603L
275 # error "__cpp_lib_sample should have the value 201603L in c++20"
278 # ifndef __cpp_lib_shift
279 # error "__cpp_lib_shift should be defined in c++20"
281 # if __cpp_lib_shift != 201806L
282 # error "__cpp_lib_shift should have the value 201806L in c++20"
285 #elif TEST_STD_VER == 23
287 # ifndef __cpp_lib_clamp
288 # error "__cpp_lib_clamp should be defined in c++23"
290 # if __cpp_lib_clamp != 201603L
291 # error "__cpp_lib_clamp should have the value 201603L in c++23"
294 # ifndef __cpp_lib_constexpr_algorithms
295 # error "__cpp_lib_constexpr_algorithms should be defined in c++23"
297 # if __cpp_lib_constexpr_algorithms != 201806L
298 # error "__cpp_lib_constexpr_algorithms should have the value 201806L in c++23"
301 # ifdef __cpp_lib_default_template_type_for_algorithm_values
302 # error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"
305 # ifdef __cpp_lib_freestanding_algorithm
306 # error "__cpp_lib_freestanding_algorithm should not be defined before c++26"
309 # if !defined(_LIBCPP_VERSION)
310 # ifndef __cpp_lib_parallel_algorithm
311 # error "__cpp_lib_parallel_algorithm should be defined in c++23"
313 # if __cpp_lib_parallel_algorithm != 201603L
314 # error "__cpp_lib_parallel_algorithm should have the value 201603L in c++23"
316 # else // _LIBCPP_VERSION
317 # ifdef __cpp_lib_parallel_algorithm
318 # error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
322 # ifndef __cpp_lib_ranges
323 # error "__cpp_lib_ranges should be defined in c++23"
325 # if __cpp_lib_ranges != 202211L
326 # error "__cpp_lib_ranges should have the value 202211L in c++23"
329 # ifndef __cpp_lib_ranges_contains
330 # error "__cpp_lib_ranges_contains should be defined in c++23"
332 # if __cpp_lib_ranges_contains != 202207L
333 # error "__cpp_lib_ranges_contains should have the value 202207L in c++23"
336 # ifndef __cpp_lib_ranges_find_last
337 # error "__cpp_lib_ranges_find_last should be defined in c++23"
339 # if __cpp_lib_ranges_find_last != 202207L
340 # error "__cpp_lib_ranges_find_last should have the value 202207L in c++23"
343 # ifndef __cpp_lib_ranges_starts_ends_with
344 # error "__cpp_lib_ranges_starts_ends_with should be defined in c++23"
346 # if __cpp_lib_ranges_starts_ends_with != 202106L
347 # error "__cpp_lib_ranges_starts_ends_with should have the value 202106L in c++23"
350 # ifndef __cpp_lib_robust_nonmodifying_seq_ops
351 # error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++23"
353 # if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
354 # error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++23"
357 # ifndef __cpp_lib_sample
358 # error "__cpp_lib_sample should be defined in c++23"
360 # if __cpp_lib_sample != 201603L
361 # error "__cpp_lib_sample should have the value 201603L in c++23"
364 # ifndef __cpp_lib_shift
365 # error "__cpp_lib_shift should be defined in c++23"
367 # if __cpp_lib_shift != 201806L
368 # error "__cpp_lib_shift should have the value 201806L in c++23"
371 #elif TEST_STD_VER > 23
373 # ifndef __cpp_lib_clamp
374 # error "__cpp_lib_clamp should be defined in c++26"
376 # if __cpp_lib_clamp != 201603L
377 # error "__cpp_lib_clamp should have the value 201603L in c++26"
380 # ifndef __cpp_lib_constexpr_algorithms
381 # error "__cpp_lib_constexpr_algorithms should be defined in c++26"
383 # if __cpp_lib_constexpr_algorithms != 201806L
384 # error "__cpp_lib_constexpr_algorithms should have the value 201806L in c++26"
387 # if !defined(_LIBCPP_VERSION)
388 # ifndef __cpp_lib_default_template_type_for_algorithm_values
389 # error "__cpp_lib_default_template_type_for_algorithm_values should be defined in c++26"
391 # if __cpp_lib_default_template_type_for_algorithm_values != 202403L
392 # error "__cpp_lib_default_template_type_for_algorithm_values should have the value 202403L in c++26"
394 # else // _LIBCPP_VERSION
395 # ifdef __cpp_lib_default_template_type_for_algorithm_values
396 # error "__cpp_lib_default_template_type_for_algorithm_values should not be defined because it is unimplemented in libc++!"
400 # if !defined(_LIBCPP_VERSION)
401 # ifndef __cpp_lib_freestanding_algorithm
402 # error "__cpp_lib_freestanding_algorithm should be defined in c++26"
404 # if __cpp_lib_freestanding_algorithm != 202311L
405 # error "__cpp_lib_freestanding_algorithm should have the value 202311L in c++26"
407 # else // _LIBCPP_VERSION
408 # ifdef __cpp_lib_freestanding_algorithm
409 # error "__cpp_lib_freestanding_algorithm should not be defined because it is unimplemented in libc++!"
413 # if !defined(_LIBCPP_VERSION)
414 # ifndef __cpp_lib_parallel_algorithm
415 # error "__cpp_lib_parallel_algorithm should be defined in c++26"
417 # if __cpp_lib_parallel_algorithm != 201603L
418 # error "__cpp_lib_parallel_algorithm should have the value 201603L in c++26"
420 # else // _LIBCPP_VERSION
421 # ifdef __cpp_lib_parallel_algorithm
422 # error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
426 # ifndef __cpp_lib_ranges
427 # error "__cpp_lib_ranges should be defined in c++26"
429 # if __cpp_lib_ranges != 202211L
430 # error "__cpp_lib_ranges should have the value 202211L in c++26"
433 # ifndef __cpp_lib_ranges_contains
434 # error "__cpp_lib_ranges_contains should be defined in c++26"
436 # if __cpp_lib_ranges_contains != 202207L
437 # error "__cpp_lib_ranges_contains should have the value 202207L in c++26"
440 # ifndef __cpp_lib_ranges_find_last
441 # error "__cpp_lib_ranges_find_last should be defined in c++26"
443 # if __cpp_lib_ranges_find_last != 202207L
444 # error "__cpp_lib_ranges_find_last should have the value 202207L in c++26"
447 # ifndef __cpp_lib_ranges_starts_ends_with
448 # error "__cpp_lib_ranges_starts_ends_with should be defined in c++26"
450 # if __cpp_lib_ranges_starts_ends_with != 202106L
451 # error "__cpp_lib_ranges_starts_ends_with should have the value 202106L in c++26"
454 # ifndef __cpp_lib_robust_nonmodifying_seq_ops
455 # error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++26"
457 # if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
458 # error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++26"
461 # ifndef __cpp_lib_sample
462 # error "__cpp_lib_sample should be defined in c++26"
464 # if __cpp_lib_sample != 201603L
465 # error "__cpp_lib_sample should have the value 201603L in c++26"
468 # ifndef __cpp_lib_shift
469 # error "__cpp_lib_shift should be defined in c++26"
471 # if __cpp_lib_shift != 201806L
472 # error "__cpp_lib_shift should have the value 201806L in c++26"
475 #endif // TEST_STD_VER > 23