string_view.version.pass.cpp 3.0 KB

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