string_view.version.pass.cpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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_view>
  13. // Test the feature test macros defined by <string_view>
  14. /* Constant Value
  15. __cpp_lib_char8_t 201811L [C++2a]
  16. __cpp_lib_constexpr_misc 201811L [C++2a]
  17. __cpp_lib_string_view 201606L [C++17]
  18. */
  19. #include <string_view>
  20. #include "test_macros.h"
  21. #if TEST_STD_VER < 14
  22. # ifdef __cpp_lib_char8_t
  23. # error "__cpp_lib_char8_t should not be defined before c++2a"
  24. # endif
  25. # ifdef __cpp_lib_constexpr_misc
  26. # error "__cpp_lib_constexpr_misc should not be defined before c++2a"
  27. # endif
  28. # ifdef __cpp_lib_string_view
  29. # error "__cpp_lib_string_view should not be defined before c++17"
  30. # endif
  31. #elif TEST_STD_VER == 14
  32. # ifdef __cpp_lib_char8_t
  33. # error "__cpp_lib_char8_t should not be defined before c++2a"
  34. # endif
  35. # ifdef __cpp_lib_constexpr_misc
  36. # error "__cpp_lib_constexpr_misc should not be defined before c++2a"
  37. # endif
  38. # ifdef __cpp_lib_string_view
  39. # error "__cpp_lib_string_view should not be defined before c++17"
  40. # endif
  41. #elif TEST_STD_VER == 17
  42. # ifdef __cpp_lib_char8_t
  43. # error "__cpp_lib_char8_t should not be defined before c++2a"
  44. # endif
  45. # ifdef __cpp_lib_constexpr_misc
  46. # error "__cpp_lib_constexpr_misc should not be defined before c++2a"
  47. # endif
  48. # ifndef __cpp_lib_string_view
  49. # error "__cpp_lib_string_view should be defined in c++17"
  50. # endif
  51. # if __cpp_lib_string_view != 201606L
  52. # error "__cpp_lib_string_view should have the value 201606L in c++17"
  53. # endif
  54. #elif TEST_STD_VER > 17
  55. # if defined(__cpp_char8_t)
  56. # ifndef __cpp_lib_char8_t
  57. # error "__cpp_lib_char8_t should be defined in c++2a"
  58. # endif
  59. # if __cpp_lib_char8_t != 201811L
  60. # error "__cpp_lib_char8_t should have the value 201811L in c++2a"
  61. # endif
  62. # else
  63. # ifdef __cpp_lib_char8_t
  64. # error "__cpp_lib_char8_t should not be defined when defined(__cpp_char8_t) is not defined!"
  65. # endif
  66. # endif
  67. # if !defined(_LIBCPP_VERSION)
  68. # ifndef __cpp_lib_constexpr_misc
  69. # error "__cpp_lib_constexpr_misc should be defined in c++2a"
  70. # endif
  71. # if __cpp_lib_constexpr_misc != 201811L
  72. # error "__cpp_lib_constexpr_misc should have the value 201811L in c++2a"
  73. # endif
  74. # else // _LIBCPP_VERSION
  75. # ifdef __cpp_lib_constexpr_misc
  76. # error "__cpp_lib_constexpr_misc should not be defined because it is unimplemented in libc++!"
  77. # endif
  78. # endif
  79. # ifndef __cpp_lib_string_view
  80. # error "__cpp_lib_string_view should be defined in c++2a"
  81. # endif
  82. # if __cpp_lib_string_view != 201606L
  83. # error "__cpp_lib_string_view should have the value 201606L in c++2a"
  84. # endif
  85. #endif // TEST_STD_VER > 17
  86. int main() {}