memory.version.pass.cpp 8.3 KB

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