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