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