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