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// <numeric>
13
14// Test the feature test macros defined by <numeric>
15
16// clang-format off
17
18#include <numeric>
19#include "test_macros.h"
20
21#if TEST_STD_VER < 14
22
23# ifdef __cpp_lib_constexpr_numeric
24# error "__cpp_lib_constexpr_numeric should not be defined before c++20"
25# endif
26
27# ifdef __cpp_lib_gcd_lcm
28# error "__cpp_lib_gcd_lcm should not be defined before c++17"
29# endif
30
31# ifdef __cpp_lib_interpolate
32# error "__cpp_lib_interpolate should not be defined before c++20"
33# endif
34
35# ifdef __cpp_lib_parallel_algorithm
36# error "__cpp_lib_parallel_algorithm should not be defined before c++17"
37# endif
38
39# ifdef __cpp_lib_ranges_iota
40# error "__cpp_lib_ranges_iota should not be defined before c++23"
41# endif
42
43# ifdef __cpp_lib_saturation_arithmetic
44# error "__cpp_lib_saturation_arithmetic should not be defined before c++26"
45# endif
46
47#elif TEST_STD_VER == 14
48
49# ifdef __cpp_lib_constexpr_numeric
50# error "__cpp_lib_constexpr_numeric should not be defined before c++20"
51# endif
52
53# ifdef __cpp_lib_gcd_lcm
54# error "__cpp_lib_gcd_lcm should not be defined before c++17"
55# endif
56
57# ifdef __cpp_lib_interpolate
58# error "__cpp_lib_interpolate should not be defined before c++20"
59# endif
60
61# ifdef __cpp_lib_parallel_algorithm
62# error "__cpp_lib_parallel_algorithm should not be defined before c++17"
63# endif
64
65# ifdef __cpp_lib_ranges_iota
66# error "__cpp_lib_ranges_iota should not be defined before c++23"
67# endif
68
69# ifdef __cpp_lib_saturation_arithmetic
70# error "__cpp_lib_saturation_arithmetic should not be defined before c++26"
71# endif
72
73#elif TEST_STD_VER == 17
74
75# ifdef __cpp_lib_constexpr_numeric
76# error "__cpp_lib_constexpr_numeric should not be defined before c++20"
77# endif
78
79# ifndef __cpp_lib_gcd_lcm
80# error "__cpp_lib_gcd_lcm should be defined in c++17"
81# endif
82# if __cpp_lib_gcd_lcm != 201606L
83# error "__cpp_lib_gcd_lcm should have the value 201606L in c++17"
84# endif
85
86# ifdef __cpp_lib_interpolate
87# error "__cpp_lib_interpolate should not be defined before c++20"
88# endif
89
90# if !defined(_LIBCPP_VERSION)
91# ifndef __cpp_lib_parallel_algorithm
92# error "__cpp_lib_parallel_algorithm should be defined in c++17"
93# endif
94# if __cpp_lib_parallel_algorithm != 201603L
95# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++17"
96# endif
97# else
98# ifdef __cpp_lib_parallel_algorithm
99# error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
100# endif
101# endif
102
103# ifdef __cpp_lib_ranges_iota
104# error "__cpp_lib_ranges_iota should not be defined before c++23"
105# endif
106
107# ifdef __cpp_lib_saturation_arithmetic
108# error "__cpp_lib_saturation_arithmetic should not be defined before c++26"
109# endif
110
111#elif TEST_STD_VER == 20
112
113# ifndef __cpp_lib_constexpr_numeric
114# error "__cpp_lib_constexpr_numeric should be defined in c++20"
115# endif
116# if __cpp_lib_constexpr_numeric != 201911L
117# error "__cpp_lib_constexpr_numeric should have the value 201911L in c++20"
118# endif
119
120# ifndef __cpp_lib_gcd_lcm
121# error "__cpp_lib_gcd_lcm should be defined in c++20"
122# endif
123# if __cpp_lib_gcd_lcm != 201606L
124# error "__cpp_lib_gcd_lcm should have the value 201606L in c++20"
125# endif
126
127# ifndef __cpp_lib_interpolate
128# error "__cpp_lib_interpolate should be defined in c++20"
129# endif
130# if __cpp_lib_interpolate != 201902L
131# error "__cpp_lib_interpolate should have the value 201902L in c++20"
132# endif
133
134# if !defined(_LIBCPP_VERSION)
135# ifndef __cpp_lib_parallel_algorithm
136# error "__cpp_lib_parallel_algorithm should be defined in c++20"
137# endif
138# if __cpp_lib_parallel_algorithm != 201603L
139# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++20"
140# endif
141# else
142# ifdef __cpp_lib_parallel_algorithm
143# error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
144# endif
145# endif
146
147# ifdef __cpp_lib_ranges_iota
148# error "__cpp_lib_ranges_iota should not be defined before c++23"
149# endif
150
151# ifdef __cpp_lib_saturation_arithmetic
152# error "__cpp_lib_saturation_arithmetic should not be defined before c++26"
153# endif
154
155#elif TEST_STD_VER == 23
156
157# ifndef __cpp_lib_constexpr_numeric
158# error "__cpp_lib_constexpr_numeric should be defined in c++23"
159# endif
160# if __cpp_lib_constexpr_numeric != 201911L
161# error "__cpp_lib_constexpr_numeric should have the value 201911L in c++23"
162# endif
163
164# ifndef __cpp_lib_gcd_lcm
165# error "__cpp_lib_gcd_lcm should be defined in c++23"
166# endif
167# if __cpp_lib_gcd_lcm != 201606L
168# error "__cpp_lib_gcd_lcm should have the value 201606L in c++23"
169# endif
170
171# ifndef __cpp_lib_interpolate
172# error "__cpp_lib_interpolate should be defined in c++23"
173# endif
174# if __cpp_lib_interpolate != 201902L
175# error "__cpp_lib_interpolate should have the value 201902L in c++23"
176# endif
177
178# if !defined(_LIBCPP_VERSION)
179# ifndef __cpp_lib_parallel_algorithm
180# error "__cpp_lib_parallel_algorithm should be defined in c++23"
181# endif
182# if __cpp_lib_parallel_algorithm != 201603L
183# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++23"
184# endif
185# else
186# ifdef __cpp_lib_parallel_algorithm
187# error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
188# endif
189# endif
190
191# ifndef __cpp_lib_ranges_iota
192# error "__cpp_lib_ranges_iota should be defined in c++23"
193# endif
194# if __cpp_lib_ranges_iota != 202202L
195# error "__cpp_lib_ranges_iota should have the value 202202L in c++23"
196# endif
197
198# ifdef __cpp_lib_saturation_arithmetic
199# error "__cpp_lib_saturation_arithmetic should not be defined before c++26"
200# endif
201
202#elif TEST_STD_VER > 23
203
204# ifndef __cpp_lib_constexpr_numeric
205# error "__cpp_lib_constexpr_numeric should be defined in c++26"
206# endif
207# if __cpp_lib_constexpr_numeric != 201911L
208# error "__cpp_lib_constexpr_numeric should have the value 201911L in c++26"
209# endif
210
211# ifndef __cpp_lib_gcd_lcm
212# error "__cpp_lib_gcd_lcm should be defined in c++26"
213# endif
214# if __cpp_lib_gcd_lcm != 201606L
215# error "__cpp_lib_gcd_lcm should have the value 201606L in c++26"
216# endif
217
218# ifndef __cpp_lib_interpolate
219# error "__cpp_lib_interpolate should be defined in c++26"
220# endif
221# if __cpp_lib_interpolate != 201902L
222# error "__cpp_lib_interpolate should have the value 201902L in c++26"
223# endif
224
225# if !defined(_LIBCPP_VERSION)
226# ifndef __cpp_lib_parallel_algorithm
227# error "__cpp_lib_parallel_algorithm should be defined in c++26"
228# endif
229# if __cpp_lib_parallel_algorithm != 201603L
230# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++26"
231# endif
232# else
233# ifdef __cpp_lib_parallel_algorithm
234# error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
235# endif
236# endif
237
238# ifndef __cpp_lib_ranges_iota
239# error "__cpp_lib_ranges_iota should be defined in c++26"
240# endif
241# if __cpp_lib_ranges_iota != 202202L
242# error "__cpp_lib_ranges_iota should have the value 202202L in c++26"
243# endif
244
245# ifndef __cpp_lib_saturation_arithmetic
246# error "__cpp_lib_saturation_arithmetic should be defined in c++26"
247# endif
248# if __cpp_lib_saturation_arithmetic != 202311L
249# error "__cpp_lib_saturation_arithmetic should have the value 202311L in c++26"
250# endif
251
252#endif // TEST_STD_VER > 23
253
254// clang-format on
255
256

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