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

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