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 10 // <string_view> 11 12 // constexpr basic_string_view () noexcept; 13 14 #include <string_view> 15 #include <cassert> 16 17 #include "test_macros.h" 18 19 template<typename T> test()20void test () { 21 #if TEST_STD_VER > 11 22 { 23 ASSERT_NOEXCEPT(T()); 24 25 constexpr T sv1; 26 static_assert ( sv1.size() == 0, "" ); 27 static_assert ( sv1.empty(), ""); 28 } 29 #endif 30 31 { 32 T sv1; 33 assert ( sv1.size() == 0 ); 34 assert ( sv1.empty()); 35 } 36 } 37 main(int,char **)38int main(int, char**) { 39 test<std::string_view> (); 40 test<std::u16string_view> (); 41 #if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L 42 test<std::u8string_view> (); 43 #endif 44 test<std::u32string_view> (); 45 test<std::wstring_view> (); 46 47 48 return 0; 49 } 50