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 9053d81ceSMarshall Clow 10053d81ceSMarshall Clow // <string_view> 11053d81ceSMarshall Clow 12053d81ceSMarshall Clow // constexpr basic_string_view () noexcept; 13053d81ceSMarshall Clow 14053d81ceSMarshall Clow #include <string_view> 15053d81ceSMarshall Clow #include <cassert> 16053d81ceSMarshall Clow 170f901c7eSStephan T. Lavavej #include "test_macros.h" 180f901c7eSStephan T. Lavavej 19053d81ceSMarshall Clow template<typename T> 20053d81ceSMarshall Clow void test () { 210f901c7eSStephan T. Lavavej #if TEST_STD_VER > 11 22053d81ceSMarshall Clow { 23ac2b3e3aSMarshall Clow ASSERT_NOEXCEPT(T()); 24ac2b3e3aSMarshall Clow 25053d81ceSMarshall Clow constexpr T sv1; 26053d81ceSMarshall Clow static_assert ( sv1.size() == 0, "" ); 27053d81ceSMarshall Clow static_assert ( sv1.empty(), ""); 28053d81ceSMarshall Clow } 29053d81ceSMarshall Clow #endif 30053d81ceSMarshall Clow 31053d81ceSMarshall Clow { 32053d81ceSMarshall Clow T sv1; 33053d81ceSMarshall Clow assert ( sv1.size() == 0 ); 34053d81ceSMarshall Clow assert ( sv1.empty()); 35053d81ceSMarshall Clow } 36053d81ceSMarshall Clow } 37053d81ceSMarshall Clow 38*2df59c50SJF Bastien int main(int, char**) { 397dad0bd6SMarshall Clow test<std::string_view> (); 407dad0bd6SMarshall Clow test<std::u16string_view> (); 417dad0bd6SMarshall Clow #if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L 427dad0bd6SMarshall Clow test<std::u8string_view> (); 437dad0bd6SMarshall Clow #endif 447dad0bd6SMarshall Clow test<std::u32string_view> (); 457dad0bd6SMarshall Clow test<std::wstring_view> (); 46053d81ceSMarshall Clow 47*2df59c50SJF Bastien 48*2df59c50SJF Bastien return 0; 49053d81ceSMarshall Clow } 50