string.version.pass.cpp 5.5 KB

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