algorithm.version.pass.cpp 6.0 KB

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