memory.version.pass.cpp 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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. // <memory>
  12. // Test the feature test macros defined by <memory>
  13. /* Constant Value
  14. __cpp_lib_addressof_constexpr 201603L [C++17]
  15. __cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
  16. __cpp_lib_enable_shared_from_this 201603L [C++17]
  17. __cpp_lib_make_unique 201304L [C++14]
  18. __cpp_lib_ranges 201811L [C++2a]
  19. __cpp_lib_raw_memory_algorithms 201606L [C++17]
  20. __cpp_lib_shared_ptr_arrays 201611L [C++17]
  21. __cpp_lib_shared_ptr_weak_type 201606L [C++17]
  22. */
  23. #include <memory>
  24. #include "test_macros.h"
  25. #if TEST_STD_VER < 14
  26. # ifdef __cpp_lib_addressof_constexpr
  27. # error "__cpp_lib_addressof_constexpr should not be defined before c++17"
  28. # endif
  29. # ifdef __cpp_lib_allocator_traits_is_always_equal
  30. # error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
  31. # endif
  32. # ifdef __cpp_lib_enable_shared_from_this
  33. # error "__cpp_lib_enable_shared_from_this should not be defined before c++17"
  34. # endif
  35. # ifdef __cpp_lib_make_unique
  36. # error "__cpp_lib_make_unique should not be defined before c++14"
  37. # endif
  38. # ifdef __cpp_lib_ranges
  39. # error "__cpp_lib_ranges should not be defined before c++2a"
  40. # endif
  41. # ifdef __cpp_lib_raw_memory_algorithms
  42. # error "__cpp_lib_raw_memory_algorithms should not be defined before c++17"
  43. # endif
  44. # ifdef __cpp_lib_shared_ptr_arrays
  45. # error "__cpp_lib_shared_ptr_arrays should not be defined before c++17"
  46. # endif
  47. # ifdef __cpp_lib_shared_ptr_weak_type
  48. # error "__cpp_lib_shared_ptr_weak_type should not be defined before c++17"
  49. # endif
  50. #elif TEST_STD_VER == 14
  51. # ifdef __cpp_lib_addressof_constexpr
  52. # error "__cpp_lib_addressof_constexpr should not be defined before c++17"
  53. # endif
  54. # ifdef __cpp_lib_allocator_traits_is_always_equal
  55. # error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
  56. # endif
  57. # ifdef __cpp_lib_enable_shared_from_this
  58. # error "__cpp_lib_enable_shared_from_this should not be defined before c++17"
  59. # endif
  60. # ifndef __cpp_lib_make_unique
  61. # error "__cpp_lib_make_unique should be defined in c++14"
  62. # endif
  63. # if __cpp_lib_make_unique != 201304L
  64. # error "__cpp_lib_make_unique should have the value 201304L in c++14"
  65. # endif
  66. # ifdef __cpp_lib_ranges
  67. # error "__cpp_lib_ranges should not be defined before c++2a"
  68. # endif
  69. # ifdef __cpp_lib_raw_memory_algorithms
  70. # error "__cpp_lib_raw_memory_algorithms should not be defined before c++17"
  71. # endif
  72. # ifdef __cpp_lib_shared_ptr_arrays
  73. # error "__cpp_lib_shared_ptr_arrays should not be defined before c++17"
  74. # endif
  75. # ifdef __cpp_lib_shared_ptr_weak_type
  76. # error "__cpp_lib_shared_ptr_weak_type should not be defined before c++17"
  77. # endif
  78. #elif TEST_STD_VER == 17
  79. # if TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700
  80. # ifndef __cpp_lib_addressof_constexpr
  81. # error "__cpp_lib_addressof_constexpr should be defined in c++17"
  82. # endif
  83. # if __cpp_lib_addressof_constexpr != 201603L
  84. # error "__cpp_lib_addressof_constexpr should have the value 201603L in c++17"
  85. # endif
  86. # else
  87. # ifdef __cpp_lib_addressof_constexpr
  88. # error "__cpp_lib_addressof_constexpr should not be defined when TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700 is not defined!"
  89. # endif
  90. # endif
  91. # ifndef __cpp_lib_allocator_traits_is_always_equal
  92. # error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
  93. # endif
  94. # if __cpp_lib_allocator_traits_is_always_equal != 201411L
  95. # error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
  96. # endif
  97. # ifndef __cpp_lib_enable_shared_from_this
  98. # error "__cpp_lib_enable_shared_from_this should be defined in c++17"
  99. # endif
  100. # if __cpp_lib_enable_shared_from_this != 201603L
  101. # error "__cpp_lib_enable_shared_from_this should have the value 201603L in c++17"
  102. # endif
  103. # ifndef __cpp_lib_make_unique
  104. # error "__cpp_lib_make_unique should be defined in c++17"
  105. # endif
  106. # if __cpp_lib_make_unique != 201304L
  107. # error "__cpp_lib_make_unique should have the value 201304L in c++17"
  108. # endif
  109. # ifdef __cpp_lib_ranges
  110. # error "__cpp_lib_ranges should not be defined before c++2a"
  111. # endif
  112. # ifndef __cpp_lib_raw_memory_algorithms
  113. # error "__cpp_lib_raw_memory_algorithms should be defined in c++17"
  114. # endif
  115. # if __cpp_lib_raw_memory_algorithms != 201606L
  116. # error "__cpp_lib_raw_memory_algorithms should have the value 201606L in c++17"
  117. # endif
  118. # if !defined(_LIBCPP_VERSION)
  119. # ifndef __cpp_lib_shared_ptr_arrays
  120. # error "__cpp_lib_shared_ptr_arrays should be defined in c++17"
  121. # endif
  122. # if __cpp_lib_shared_ptr_arrays != 201611L
  123. # error "__cpp_lib_shared_ptr_arrays should have the value 201611L in c++17"
  124. # endif
  125. # else // _LIBCPP_VERSION
  126. # ifdef __cpp_lib_shared_ptr_arrays
  127. # error "__cpp_lib_shared_ptr_arrays should not be defined because it is unimplemented in libc++!"
  128. # endif
  129. # endif
  130. # ifndef __cpp_lib_shared_ptr_weak_type
  131. # error "__cpp_lib_shared_ptr_weak_type should be defined in c++17"
  132. # endif
  133. # if __cpp_lib_shared_ptr_weak_type != 201606L
  134. # error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++17"
  135. # endif
  136. #elif TEST_STD_VER > 17
  137. # if TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700
  138. # ifndef __cpp_lib_addressof_constexpr
  139. # error "__cpp_lib_addressof_constexpr should be defined in c++2a"
  140. # endif
  141. # if __cpp_lib_addressof_constexpr != 201603L
  142. # error "__cpp_lib_addressof_constexpr should have the value 201603L in c++2a"
  143. # endif
  144. # else
  145. # ifdef __cpp_lib_addressof_constexpr
  146. # error "__cpp_lib_addressof_constexpr should not be defined when TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700 is not defined!"
  147. # endif
  148. # endif
  149. # ifndef __cpp_lib_allocator_traits_is_always_equal
  150. # error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a"
  151. # endif
  152. # if __cpp_lib_allocator_traits_is_always_equal != 201411L
  153. # error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a"
  154. # endif
  155. # ifndef __cpp_lib_enable_shared_from_this
  156. # error "__cpp_lib_enable_shared_from_this should be defined in c++2a"
  157. # endif
  158. # if __cpp_lib_enable_shared_from_this != 201603L
  159. # error "__cpp_lib_enable_shared_from_this should have the value 201603L in c++2a"
  160. # endif
  161. # ifndef __cpp_lib_make_unique
  162. # error "__cpp_lib_make_unique should be defined in c++2a"
  163. # endif
  164. # if __cpp_lib_make_unique != 201304L
  165. # error "__cpp_lib_make_unique should have the value 201304L in c++2a"
  166. # endif
  167. # if !defined(_LIBCPP_VERSION)
  168. # ifndef __cpp_lib_ranges
  169. # error "__cpp_lib_ranges should be defined in c++2a"
  170. # endif
  171. # if __cpp_lib_ranges != 201811L
  172. # error "__cpp_lib_ranges should have the value 201811L in c++2a"
  173. # endif
  174. # else // _LIBCPP_VERSION
  175. # ifdef __cpp_lib_ranges
  176. # error "__cpp_lib_ranges should not be defined because it is unimplemented in libc++!"
  177. # endif
  178. # endif
  179. # ifndef __cpp_lib_raw_memory_algorithms
  180. # error "__cpp_lib_raw_memory_algorithms should be defined in c++2a"
  181. # endif
  182. # if __cpp_lib_raw_memory_algorithms != 201606L
  183. # error "__cpp_lib_raw_memory_algorithms should have the value 201606L in c++2a"
  184. # endif
  185. # if !defined(_LIBCPP_VERSION)
  186. # ifndef __cpp_lib_shared_ptr_arrays
  187. # error "__cpp_lib_shared_ptr_arrays should be defined in c++2a"
  188. # endif
  189. # if __cpp_lib_shared_ptr_arrays != 201611L
  190. # error "__cpp_lib_shared_ptr_arrays should have the value 201611L in c++2a"
  191. # endif
  192. # else // _LIBCPP_VERSION
  193. # ifdef __cpp_lib_shared_ptr_arrays
  194. # error "__cpp_lib_shared_ptr_arrays should not be defined because it is unimplemented in libc++!"
  195. # endif
  196. # endif
  197. # ifndef __cpp_lib_shared_ptr_weak_type
  198. # error "__cpp_lib_shared_ptr_weak_type should be defined in c++2a"
  199. # endif
  200. # if __cpp_lib_shared_ptr_weak_type != 201606L
  201. # error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++2a"
  202. # endif
  203. #endif // TEST_STD_VER > 17
  204. int main(int, char**) { return 0; }