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]
25 __cpp_lib_ranges_contains 202207L [C++23]
26 __cpp_lib_ranges_find_last 202207L [C++23]
27 __cpp_lib_ranges_starts_ends_with 202106L [C++23]
28 __cpp_lib_robust_nonmodifying_seq_ops 201304L [C++14]
29 __cpp_lib_sample 201603L [C++17]
30 __cpp_lib_shift 201806L [C++20]
34 #include "test_macros.h"
38 # ifdef __cpp_lib_clamp
39 # error "__cpp_lib_clamp should not be defined before c++17"
42 # ifdef __cpp_lib_constexpr_algorithms
43 # error "__cpp_lib_constexpr_algorithms should not be defined before c++20"
46 # ifdef __cpp_lib_default_template_type_for_algorithm_values
47 # error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"
50 # ifdef __cpp_lib_freestanding_algorithm
51 # error "__cpp_lib_freestanding_algorithm should not be defined before c++26"
54 # ifdef __cpp_lib_parallel_algorithm
55 # error "__cpp_lib_parallel_algorithm should not be defined before c++17"
58 # ifdef __cpp_lib_ranges
59 # error "__cpp_lib_ranges should not be defined before c++20"
62 # ifdef __cpp_lib_ranges_contains
63 # error "__cpp_lib_ranges_contains should not be defined before c++23"
66 # ifdef __cpp_lib_ranges_find_last
67 # error "__cpp_lib_ranges_find_last should not be defined before c++23"
70 # ifdef __cpp_lib_ranges_starts_ends_with
71 # error "__cpp_lib_ranges_starts_ends_with should not be defined before c++23"
74 # ifdef __cpp_lib_robust_nonmodifying_seq_ops
75 # error "__cpp_lib_robust_nonmodifying_seq_ops should not be defined before c++14"
78 # ifdef __cpp_lib_sample
79 # error "__cpp_lib_sample should not be defined before c++17"
82 # ifdef __cpp_lib_shift
83 # error "__cpp_lib_shift should not be defined before c++20"
86 #elif TEST_STD_VER == 14
88 # ifdef __cpp_lib_clamp
89 # error "__cpp_lib_clamp should not be defined before c++17"
92 # ifdef __cpp_lib_constexpr_algorithms
93 # error "__cpp_lib_constexpr_algorithms should not be defined before c++20"
96 # ifdef __cpp_lib_default_template_type_for_algorithm_values
97 # error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"
100 # ifdef __cpp_lib_freestanding_algorithm
101 # error "__cpp_lib_freestanding_algorithm should not be defined before c++26"
104 # ifdef __cpp_lib_parallel_algorithm
105 # error "__cpp_lib_parallel_algorithm should not be defined before c++17"
108 # ifdef __cpp_lib_ranges
109 # error "__cpp_lib_ranges should not be defined before c++20"
112 # ifdef __cpp_lib_ranges_contains
113 # error "__cpp_lib_ranges_contains should not be defined before c++23"
116 # ifdef __cpp_lib_ranges_find_last
117 # error "__cpp_lib_ranges_find_last should not be defined before c++23"
120 # ifdef __cpp_lib_ranges_starts_ends_with
121 # error "__cpp_lib_ranges_starts_ends_with should not be defined before c++23"
124 # ifndef __cpp_lib_robust_nonmodifying_seq_ops
125 # error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++14"
127 # if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
128 # error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++14"
131 # ifdef __cpp_lib_sample
132 # error "__cpp_lib_sample should not be defined before c++17"
135 # ifdef __cpp_lib_shift
136 # error "__cpp_lib_shift should not be defined before c++20"
139 #elif TEST_STD_VER == 17
141 # ifndef __cpp_lib_clamp
142 # error "__cpp_lib_clamp should be defined in c++17"
144 # if __cpp_lib_clamp != 201603L
145 # error "__cpp_lib_clamp should have the value 201603L in c++17"
148 # ifdef __cpp_lib_constexpr_algorithms
149 # error "__cpp_lib_constexpr_algorithms should not be defined before c++20"
152 # ifdef __cpp_lib_default_template_type_for_algorithm_values
153 # error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"
156 # ifdef __cpp_lib_freestanding_algorithm
157 # error "__cpp_lib_freestanding_algorithm should not be defined before c++26"
160 # if !defined(_LIBCPP_VERSION)
161 # ifndef __cpp_lib_parallel_algorithm
162 # error "__cpp_lib_parallel_algorithm should be defined in c++17"
164 # if __cpp_lib_parallel_algorithm != 201603L
165 # error "__cpp_lib_parallel_algorithm should have the value 201603L in c++17"
167 # else // _LIBCPP_VERSION
168 # ifdef __cpp_lib_parallel_algorithm
169 # error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
173 # ifdef __cpp_lib_ranges
174 # error "__cpp_lib_ranges should not be defined before c++20"
177 # ifdef __cpp_lib_ranges_contains
178 # error "__cpp_lib_ranges_contains should not be defined before c++23"
181 # ifdef __cpp_lib_ranges_find_last
182 # error "__cpp_lib_ranges_find_last should not be defined before c++23"
185 # ifdef __cpp_lib_ranges_starts_ends_with
186 # error "__cpp_lib_ranges_starts_ends_with should not be defined before c++23"
189 # ifndef __cpp_lib_robust_nonmodifying_seq_ops
190 # error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++17"
192 # if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
193 # error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++17"
196 # ifndef __cpp_lib_sample
197 # error "__cpp_lib_sample should be defined in c++17"
199 # if __cpp_lib_sample != 201603L
200 # error "__cpp_lib_sample should have the value 201603L in c++17"
203 # ifdef __cpp_lib_shift
204 # error "__cpp_lib_shift should not be defined before c++20"
207 #elif TEST_STD_VER == 20
209 # ifndef __cpp_lib_clamp
210 # error "__cpp_lib_clamp should be defined in c++20"
212 # if __cpp_lib_clamp != 201603L
213 # error "__cpp_lib_clamp should have the value 201603L in c++20"
216 # ifndef __cpp_lib_constexpr_algorithms
217 # error "__cpp_lib_constexpr_algorithms should be defined in c++20"
219 # if __cpp_lib_constexpr_algorithms != 201806L
220 # error "__cpp_lib_constexpr_algorithms should have the value 201806L in c++20"
223 # ifdef __cpp_lib_default_template_type_for_algorithm_values
224 # error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"
227 # ifdef __cpp_lib_freestanding_algorithm
228 # error "__cpp_lib_freestanding_algorithm should not be defined before c++26"
231 # if !defined(_LIBCPP_VERSION)
232 # ifndef __cpp_lib_parallel_algorithm
233 # error "__cpp_lib_parallel_algorithm should be defined in c++20"
235 # if __cpp_lib_parallel_algorithm != 201603L
236 # error "__cpp_lib_parallel_algorithm should have the value 201603L in c++20"
238 # else // _LIBCPP_VERSION
239 # ifdef __cpp_lib_parallel_algorithm
240 # error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
244 # ifndef __cpp_lib_ranges
245 # error "__cpp_lib_ranges should be defined in c++20"
247 # if __cpp_lib_ranges != 202207L
248 # error "__cpp_lib_ranges should have the value 202207L in c++20"
251 # ifdef __cpp_lib_ranges_contains
252 # error "__cpp_lib_ranges_contains should not be defined before c++23"
255 # ifdef __cpp_lib_ranges_find_last
256 # error "__cpp_lib_ranges_find_last should not be defined before c++23"
259 # ifdef __cpp_lib_ranges_starts_ends_with
260 # error "__cpp_lib_ranges_starts_ends_with should not be defined before c++23"
263 # ifndef __cpp_lib_robust_nonmodifying_seq_ops
264 # error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++20"
266 # if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
267 # error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++20"
270 # ifndef __cpp_lib_sample
271 # error "__cpp_lib_sample should be defined in c++20"
273 # if __cpp_lib_sample != 201603L
274 # error "__cpp_lib_sample should have the value 201603L in c++20"
277 # ifndef __cpp_lib_shift
278 # error "__cpp_lib_shift should be defined in c++20"
280 # if __cpp_lib_shift != 201806L
281 # error "__cpp_lib_shift should have the value 201806L in c++20"
284 #elif TEST_STD_VER == 23
286 # ifndef __cpp_lib_clamp
287 # error "__cpp_lib_clamp should be defined in c++23"
289 # if __cpp_lib_clamp != 201603L
290 # error "__cpp_lib_clamp should have the value 201603L in c++23"
293 # ifndef __cpp_lib_constexpr_algorithms
294 # error "__cpp_lib_constexpr_algorithms should be defined in c++23"
296 # if __cpp_lib_constexpr_algorithms != 201806L
297 # error "__cpp_lib_constexpr_algorithms should have the value 201806L in c++23"
300 # ifdef __cpp_lib_default_template_type_for_algorithm_values
301 # error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"
304 # ifdef __cpp_lib_freestanding_algorithm
305 # error "__cpp_lib_freestanding_algorithm should not be defined before c++26"
308 # if !defined(_LIBCPP_VERSION)
309 # ifndef __cpp_lib_parallel_algorithm
310 # error "__cpp_lib_parallel_algorithm should be defined in c++23"
312 # if __cpp_lib_parallel_algorithm != 201603L
313 # error "__cpp_lib_parallel_algorithm should have the value 201603L in c++23"
315 # else // _LIBCPP_VERSION
316 # ifdef __cpp_lib_parallel_algorithm
317 # error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
321 # ifndef __cpp_lib_ranges
322 # error "__cpp_lib_ranges should be defined in c++23"
324 # if __cpp_lib_ranges != 202207L
325 # error "__cpp_lib_ranges should have the value 202207L in c++23"
328 # ifndef __cpp_lib_ranges_contains
329 # error "__cpp_lib_ranges_contains should be defined in c++23"
331 # if __cpp_lib_ranges_contains != 202207L
332 # error "__cpp_lib_ranges_contains should have the value 202207L in c++23"
335 # ifndef __cpp_lib_ranges_find_last
336 # error "__cpp_lib_ranges_find_last should be defined in c++23"
338 # if __cpp_lib_ranges_find_last != 202207L
339 # error "__cpp_lib_ranges_find_last should have the value 202207L in c++23"
342 # ifndef __cpp_lib_ranges_starts_ends_with
343 # error "__cpp_lib_ranges_starts_ends_with should be defined in c++23"
345 # if __cpp_lib_ranges_starts_ends_with != 202106L
346 # error "__cpp_lib_ranges_starts_ends_with should have the value 202106L in c++23"
349 # ifndef __cpp_lib_robust_nonmodifying_seq_ops
350 # error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++23"
352 # if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
353 # error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++23"
356 # ifndef __cpp_lib_sample
357 # error "__cpp_lib_sample should be defined in c++23"
359 # if __cpp_lib_sample != 201603L
360 # error "__cpp_lib_sample should have the value 201603L in c++23"
363 # ifndef __cpp_lib_shift
364 # error "__cpp_lib_shift should be defined in c++23"
366 # if __cpp_lib_shift != 201806L
367 # error "__cpp_lib_shift should have the value 201806L in c++23"
370 #elif TEST_STD_VER > 23
372 # ifndef __cpp_lib_clamp
373 # error "__cpp_lib_clamp should be defined in c++26"
375 # if __cpp_lib_clamp != 201603L
376 # error "__cpp_lib_clamp should have the value 201603L in c++26"
379 # ifndef __cpp_lib_constexpr_algorithms
380 # error "__cpp_lib_constexpr_algorithms should be defined in c++26"
382 # if __cpp_lib_constexpr_algorithms != 201806L
383 # error "__cpp_lib_constexpr_algorithms should have the value 201806L in c++26"
386 # if !defined(_LIBCPP_VERSION)
387 # ifndef __cpp_lib_default_template_type_for_algorithm_values
388 # error "__cpp_lib_default_template_type_for_algorithm_values should be defined in c++26"
390 # if __cpp_lib_default_template_type_for_algorithm_values != 202403L
391 # error "__cpp_lib_default_template_type_for_algorithm_values should have the value 202403L in c++26"
393 # else // _LIBCPP_VERSION
394 # ifdef __cpp_lib_default_template_type_for_algorithm_values
395 # error "__cpp_lib_default_template_type_for_algorithm_values should not be defined because it is unimplemented in libc++!"
399 # if !defined(_LIBCPP_VERSION)
400 # ifndef __cpp_lib_freestanding_algorithm
401 # error "__cpp_lib_freestanding_algorithm should be defined in c++26"
403 # if __cpp_lib_freestanding_algorithm != 202311L
404 # error "__cpp_lib_freestanding_algorithm should have the value 202311L in c++26"
406 # else // _LIBCPP_VERSION
407 # ifdef __cpp_lib_freestanding_algorithm
408 # error "__cpp_lib_freestanding_algorithm should not be defined because it is unimplemented in libc++!"
412 # if !defined(_LIBCPP_VERSION)
413 # ifndef __cpp_lib_parallel_algorithm
414 # error "__cpp_lib_parallel_algorithm should be defined in c++26"
416 # if __cpp_lib_parallel_algorithm != 201603L
417 # error "__cpp_lib_parallel_algorithm should have the value 201603L in c++26"
419 # else // _LIBCPP_VERSION
420 # ifdef __cpp_lib_parallel_algorithm
421 # error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
425 # ifndef __cpp_lib_ranges
426 # error "__cpp_lib_ranges should be defined in c++26"
428 # if __cpp_lib_ranges != 202207L
429 # error "__cpp_lib_ranges should have the value 202207L in c++26"
432 # ifndef __cpp_lib_ranges_contains
433 # error "__cpp_lib_ranges_contains should be defined in c++26"
435 # if __cpp_lib_ranges_contains != 202207L
436 # error "__cpp_lib_ranges_contains should have the value 202207L in c++26"
439 # ifndef __cpp_lib_ranges_find_last
440 # error "__cpp_lib_ranges_find_last should be defined in c++26"
442 # if __cpp_lib_ranges_find_last != 202207L
443 # error "__cpp_lib_ranges_find_last should have the value 202207L in c++26"
446 # ifndef __cpp_lib_ranges_starts_ends_with
447 # error "__cpp_lib_ranges_starts_ends_with should be defined in c++26"
449 # if __cpp_lib_ranges_starts_ends_with != 202106L
450 # error "__cpp_lib_ranges_starts_ends_with should have the value 202106L in c++26"
453 # ifndef __cpp_lib_robust_nonmodifying_seq_ops
454 # error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++26"
456 # if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
457 # error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++26"
460 # ifndef __cpp_lib_sample
461 # error "__cpp_lib_sample should be defined in c++26"
463 # if __cpp_lib_sample != 201603L
464 # error "__cpp_lib_sample should have the value 201603L in c++26"
467 # ifndef __cpp_lib_shift
468 # error "__cpp_lib_shift should be defined in c++26"
470 # if __cpp_lib_shift != 201806L
471 # error "__cpp_lib_shift should have the value 201806L in c++26"
474 #endif // TEST_STD_VER > 23