1053d81ceSMarshall Clow //===----------------------------------------------------------------------===// 2053d81ceSMarshall Clow // 357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6053d81ceSMarshall Clow // 7053d81ceSMarshall Clow //===----------------------------------------------------------------------===// 8053d81ceSMarshall Clow 9*4fc50236SJoe Loser // UNSUPPORTED: !stdlib=libc++ && (c++03 || c++11 || c++14) 10*4fc50236SJoe Loser 11053d81ceSMarshall Clow // <string_view> 12053d81ceSMarshall Clow 13053d81ceSMarshall Clow // constexpr basic_string_view () noexcept; 14053d81ceSMarshall Clow 15053d81ceSMarshall Clow #include <string_view> 16053d81ceSMarshall Clow #include <cassert> 17053d81ceSMarshall Clow 180f901c7eSStephan T. Lavavej #include "test_macros.h" 190f901c7eSStephan T. Lavavej 20053d81ceSMarshall Clow template<typename T> test()21053d81ceSMarshall Clowvoid test () { 220f901c7eSStephan T. Lavavej #if TEST_STD_VER > 11 23053d81ceSMarshall Clow { 24ac2b3e3aSMarshall Clow ASSERT_NOEXCEPT(T()); 25ac2b3e3aSMarshall Clow 26053d81ceSMarshall Clow constexpr T sv1; 27053d81ceSMarshall Clow static_assert ( sv1.size() == 0, "" ); 28053d81ceSMarshall Clow static_assert ( sv1.empty(), ""); 29053d81ceSMarshall Clow } 30053d81ceSMarshall Clow #endif 31053d81ceSMarshall Clow 32053d81ceSMarshall Clow { 33053d81ceSMarshall Clow T sv1; 34053d81ceSMarshall Clow assert ( sv1.size() == 0 ); 35053d81ceSMarshall Clow assert ( sv1.empty()); 36053d81ceSMarshall Clow } 37053d81ceSMarshall Clow } 38053d81ceSMarshall Clow main(int,char **)392df59c50SJF Bastienint main(int, char**) { 407dad0bd6SMarshall Clow test<std::string_view> (); 417dad0bd6SMarshall Clow test<std::u16string_view> (); 427dad0bd6SMarshall Clow #if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L 437dad0bd6SMarshall Clow test<std::u8string_view> (); 447dad0bd6SMarshall Clow #endif 457dad0bd6SMarshall Clow test<std::u32string_view> (); 46f4c1258dSLouis Dionne #ifndef TEST_HAS_NO_WIDE_CHARACTERS 477dad0bd6SMarshall Clow test<std::wstring_view> (); 48f4c1258dSLouis Dionne #endif 492df59c50SJF Bastien 502df59c50SJF Bastien return 0; 51053d81ceSMarshall Clow } 52