string.version.pass.cpp 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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. // <string>
  13. // Test the feature test macros defined by <string>
  14. /* Constant Value
  15. __cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
  16. __cpp_lib_char8_t 201811L [C++2a]
  17. __cpp_lib_erase_if 201811L [C++2a]
  18. __cpp_lib_nonmember_container_access 201411L [C++17]
  19. __cpp_lib_string_udls 201304L [C++14]
  20. __cpp_lib_string_view 201606L [C++17]
  21. */
  22. #include <string>
  23. #include "test_macros.h"
  24. #if TEST_STD_VER < 14
  25. # ifdef __cpp_lib_allocator_traits_is_always_equal
  26. # error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
  27. # endif
  28. # ifdef __cpp_lib_char8_t
  29. # error "__cpp_lib_char8_t should not be defined before c++2a"
  30. # endif
  31. # ifdef __cpp_lib_erase_if
  32. # error "__cpp_lib_erase_if should not be defined before c++2a"
  33. # endif
  34. # ifdef __cpp_lib_nonmember_container_access
  35. # error "__cpp_lib_nonmember_container_access should not be defined before c++17"
  36. # endif
  37. # ifdef __cpp_lib_string_udls
  38. # error "__cpp_lib_string_udls should not be defined before c++14"
  39. # endif
  40. # ifdef __cpp_lib_string_view
  41. # error "__cpp_lib_string_view should not be defined before c++17"
  42. # endif
  43. #elif TEST_STD_VER == 14
  44. # ifdef __cpp_lib_allocator_traits_is_always_equal
  45. # error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
  46. # endif
  47. # ifdef __cpp_lib_char8_t
  48. # error "__cpp_lib_char8_t should not be defined before c++2a"
  49. # endif
  50. # ifdef __cpp_lib_erase_if
  51. # error "__cpp_lib_erase_if should not be defined before c++2a"
  52. # endif
  53. # ifdef __cpp_lib_nonmember_container_access
  54. # error "__cpp_lib_nonmember_container_access should not be defined before c++17"
  55. # endif
  56. # ifndef __cpp_lib_string_udls
  57. # error "__cpp_lib_string_udls should be defined in c++14"
  58. # endif
  59. # if __cpp_lib_string_udls != 201304L
  60. # error "__cpp_lib_string_udls should have the value 201304L in c++14"
  61. # endif
  62. # ifdef __cpp_lib_string_view
  63. # error "__cpp_lib_string_view should not be defined before c++17"
  64. # endif
  65. #elif TEST_STD_VER == 17
  66. # ifndef __cpp_lib_allocator_traits_is_always_equal
  67. # error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
  68. # endif
  69. # if __cpp_lib_allocator_traits_is_always_equal != 201411L
  70. # error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
  71. # endif
  72. # ifdef __cpp_lib_char8_t
  73. # error "__cpp_lib_char8_t should not be defined before c++2a"
  74. # endif
  75. # ifdef __cpp_lib_erase_if
  76. # error "__cpp_lib_erase_if should not be defined before c++2a"
  77. # endif
  78. # ifndef __cpp_lib_nonmember_container_access
  79. # error "__cpp_lib_nonmember_container_access should be defined in c++17"
  80. # endif
  81. # if __cpp_lib_nonmember_container_access != 201411L
  82. # error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
  83. # endif
  84. # ifndef __cpp_lib_string_udls
  85. # error "__cpp_lib_string_udls should be defined in c++17"
  86. # endif
  87. # if __cpp_lib_string_udls != 201304L
  88. # error "__cpp_lib_string_udls should have the value 201304L in c++17"
  89. # endif
  90. # ifndef __cpp_lib_string_view
  91. # error "__cpp_lib_string_view should be defined in c++17"
  92. # endif
  93. # if __cpp_lib_string_view != 201606L
  94. # error "__cpp_lib_string_view should have the value 201606L in c++17"
  95. # endif
  96. #elif TEST_STD_VER > 17
  97. # ifndef __cpp_lib_allocator_traits_is_always_equal
  98. # error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a"
  99. # endif
  100. # if __cpp_lib_allocator_traits_is_always_equal != 201411L
  101. # error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a"
  102. # endif
  103. # if defined(__cpp_char8_t)
  104. # ifndef __cpp_lib_char8_t
  105. # error "__cpp_lib_char8_t should be defined in c++2a"
  106. # endif
  107. # if __cpp_lib_char8_t != 201811L
  108. # error "__cpp_lib_char8_t should have the value 201811L in c++2a"
  109. # endif
  110. # else
  111. # ifdef __cpp_lib_char8_t
  112. # error "__cpp_lib_char8_t should not be defined when defined(__cpp_char8_t) is not defined!"
  113. # endif
  114. # endif
  115. # ifndef __cpp_lib_erase_if
  116. # error "__cpp_lib_erase_if should be defined in c++2a"
  117. # endif
  118. # if __cpp_lib_erase_if != 201811L
  119. # error "__cpp_lib_erase_if should have the value 201811L in c++2a"
  120. # endif
  121. # ifndef __cpp_lib_nonmember_container_access
  122. # error "__cpp_lib_nonmember_container_access should be defined in c++2a"
  123. # endif
  124. # if __cpp_lib_nonmember_container_access != 201411L
  125. # error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
  126. # endif
  127. # ifndef __cpp_lib_string_udls
  128. # error "__cpp_lib_string_udls should be defined in c++2a"
  129. # endif
  130. # if __cpp_lib_string_udls != 201304L
  131. # error "__cpp_lib_string_udls should have the value 201304L in c++2a"
  132. # endif
  133. # ifndef __cpp_lib_string_view
  134. # error "__cpp_lib_string_view should be defined in c++2a"
  135. # endif
  136. # if __cpp_lib_string_view != 201606L
  137. # error "__cpp_lib_string_view should have the value 201606L in c++2a"
  138. # endif
  139. #endif // TEST_STD_VER > 17
  140. int main() {}