algorithm.version.pass.cpp 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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. // <algorithm>
  12. // Test the feature test macros defined by <algorithm>
  13. /* Constant Value
  14. __cpp_lib_clamp 201603L [C++17]
  15. __cpp_lib_constexpr_swap_algorithms 201806L [C++2a]
  16. __cpp_lib_parallel_algorithm 201603L [C++17]
  17. __cpp_lib_ranges 201811L [C++2a]
  18. __cpp_lib_robust_nonmodifying_seq_ops 201304L [C++14]
  19. __cpp_lib_sample 201603L [C++17]
  20. */
  21. #include <algorithm>
  22. #include "test_macros.h"
  23. #if TEST_STD_VER < 14
  24. # ifdef __cpp_lib_clamp
  25. # error "__cpp_lib_clamp should not be defined before c++17"
  26. # endif
  27. # ifdef __cpp_lib_constexpr_swap_algorithms
  28. # error "__cpp_lib_constexpr_swap_algorithms should not be defined before c++2a"
  29. # endif
  30. # ifdef __cpp_lib_parallel_algorithm
  31. # error "__cpp_lib_parallel_algorithm should not be defined before c++17"
  32. # endif
  33. # ifdef __cpp_lib_ranges
  34. # error "__cpp_lib_ranges should not be defined before c++2a"
  35. # endif
  36. # ifdef __cpp_lib_robust_nonmodifying_seq_ops
  37. # error "__cpp_lib_robust_nonmodifying_seq_ops should not be defined before c++14"
  38. # endif
  39. # ifdef __cpp_lib_sample
  40. # error "__cpp_lib_sample should not be defined before c++17"
  41. # endif
  42. #elif TEST_STD_VER == 14
  43. # ifdef __cpp_lib_clamp
  44. # error "__cpp_lib_clamp should not be defined before c++17"
  45. # endif
  46. # ifdef __cpp_lib_constexpr_swap_algorithms
  47. # error "__cpp_lib_constexpr_swap_algorithms should not be defined before c++2a"
  48. # endif
  49. # ifdef __cpp_lib_parallel_algorithm
  50. # error "__cpp_lib_parallel_algorithm should not be defined before c++17"
  51. # endif
  52. # ifdef __cpp_lib_ranges
  53. # error "__cpp_lib_ranges should not be defined before c++2a"
  54. # endif
  55. # ifndef __cpp_lib_robust_nonmodifying_seq_ops
  56. # error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++14"
  57. # endif
  58. # if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
  59. # error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++14"
  60. # endif
  61. # ifdef __cpp_lib_sample
  62. # error "__cpp_lib_sample should not be defined before c++17"
  63. # endif
  64. #elif TEST_STD_VER == 17
  65. # ifndef __cpp_lib_clamp
  66. # error "__cpp_lib_clamp should be defined in c++17"
  67. # endif
  68. # if __cpp_lib_clamp != 201603L
  69. # error "__cpp_lib_clamp should have the value 201603L in c++17"
  70. # endif
  71. # ifdef __cpp_lib_constexpr_swap_algorithms
  72. # error "__cpp_lib_constexpr_swap_algorithms should not be defined before c++2a"
  73. # endif
  74. # if !defined(_LIBCPP_VERSION)
  75. # ifndef __cpp_lib_parallel_algorithm
  76. # error "__cpp_lib_parallel_algorithm should be defined in c++17"
  77. # endif
  78. # if __cpp_lib_parallel_algorithm != 201603L
  79. # error "__cpp_lib_parallel_algorithm should have the value 201603L in c++17"
  80. # endif
  81. # else // _LIBCPP_VERSION
  82. # ifdef __cpp_lib_parallel_algorithm
  83. # error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
  84. # endif
  85. # endif
  86. # ifdef __cpp_lib_ranges
  87. # error "__cpp_lib_ranges should not be defined before c++2a"
  88. # endif
  89. # ifndef __cpp_lib_robust_nonmodifying_seq_ops
  90. # error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++17"
  91. # endif
  92. # if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
  93. # error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++17"
  94. # endif
  95. # ifndef __cpp_lib_sample
  96. # error "__cpp_lib_sample should be defined in c++17"
  97. # endif
  98. # if __cpp_lib_sample != 201603L
  99. # error "__cpp_lib_sample should have the value 201603L in c++17"
  100. # endif
  101. #elif TEST_STD_VER > 17
  102. # ifndef __cpp_lib_clamp
  103. # error "__cpp_lib_clamp should be defined in c++2a"
  104. # endif
  105. # if __cpp_lib_clamp != 201603L
  106. # error "__cpp_lib_clamp should have the value 201603L in c++2a"
  107. # endif
  108. # if !defined(_LIBCPP_VERSION)
  109. # ifndef __cpp_lib_constexpr_swap_algorithms
  110. # error "__cpp_lib_constexpr_swap_algorithms should be defined in c++2a"
  111. # endif
  112. # if __cpp_lib_constexpr_swap_algorithms != 201806L
  113. # error "__cpp_lib_constexpr_swap_algorithms should have the value 201806L in c++2a"
  114. # endif
  115. # else // _LIBCPP_VERSION
  116. # ifdef __cpp_lib_constexpr_swap_algorithms
  117. # error "__cpp_lib_constexpr_swap_algorithms should not be defined because it is unimplemented in libc++!"
  118. # endif
  119. # endif
  120. # if !defined(_LIBCPP_VERSION)
  121. # ifndef __cpp_lib_parallel_algorithm
  122. # error "__cpp_lib_parallel_algorithm should be defined in c++2a"
  123. # endif
  124. # if __cpp_lib_parallel_algorithm != 201603L
  125. # error "__cpp_lib_parallel_algorithm should have the value 201603L in c++2a"
  126. # endif
  127. # else // _LIBCPP_VERSION
  128. # ifdef __cpp_lib_parallel_algorithm
  129. # error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
  130. # endif
  131. # endif
  132. # if !defined(_LIBCPP_VERSION)
  133. # ifndef __cpp_lib_ranges
  134. # error "__cpp_lib_ranges should be defined in c++2a"
  135. # endif
  136. # if __cpp_lib_ranges != 201811L
  137. # error "__cpp_lib_ranges should have the value 201811L in c++2a"
  138. # endif
  139. # else // _LIBCPP_VERSION
  140. # ifdef __cpp_lib_ranges
  141. # error "__cpp_lib_ranges should not be defined because it is unimplemented in libc++!"
  142. # endif
  143. # endif
  144. # ifndef __cpp_lib_robust_nonmodifying_seq_ops
  145. # error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++2a"
  146. # endif
  147. # if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
  148. # error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++2a"
  149. # endif
  150. # ifndef __cpp_lib_sample
  151. # error "__cpp_lib_sample should be defined in c++2a"
  152. # endif
  153. # if __cpp_lib_sample != 201603L
  154. # error "__cpp_lib_sample should have the value 201603L in c++2a"
  155. # endif
  156. #endif // TEST_STD_VER > 17
  157. int main(int, char**) { return 0; }