1 //===----------------------------------------------------------------------===// 2 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 3 // See https://llvm.org/LICENSE.txt for license information. 4 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 5 // 6 //===----------------------------------------------------------------------===// 7 8 // UNSUPPORTED: c++03, c++11, c++14, c++17 9 // UNSUPPORTED: libcpp-has-no-incomplete-format 10 11 // <format> 12 13 // constexpr end() const noexcept; 14 15 #include <format> 16 17 #include <cassert> 18 #include <string_view> 19 20 #include "test_macros.h" 21 22 template <class CharT> test(const CharT * fmt)23constexpr void test(const CharT* fmt) { 24 { 25 std::basic_format_parse_context<CharT> context(fmt); 26 assert(std::to_address(context.end()) == &fmt[3]); 27 ASSERT_NOEXCEPT(context.end()); 28 } 29 { 30 std::basic_string_view view{fmt}; 31 std::basic_format_parse_context context(view); 32 assert(context.end() == view.end()); 33 ASSERT_NOEXCEPT(context.end()); 34 } 35 } 36 test()37constexpr bool test() { 38 test("abc"); 39 test(L"abc"); 40 #ifndef TEST_HAS_NO_CHAR8_T 41 test(u8"abc"); 42 #endif 43 test(u"abc"); 44 test(U"abc"); 45 46 return true; 47 } 48 main(int,char **)49int main(int, char**) { 50 test(); 51 static_assert(test()); 52 53 return 0; 54 } 55