//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME // // class range_formatter // template... Ts> // struct formatter, charT> // constexpr void set_separator(basic_string_view sep) noexcept; // Note this tests the basics of this function. It's tested in more detail in // the format functions tests. #include #include #include #include "make_string.h" #define SV(S) MAKE_STRING_VIEW(CharT, S) template constexpr void test() { std::formatter formatter; formatter.set_separator(SV("sep")); // Note the SV macro may throw, so can't use it. static_assert(noexcept(formatter.set_separator(std::basic_string_view{}))); // Note there is no direct way to validate this function modified the object. } template constexpr void test() { test>(); test>(); test>(); test>(); } constexpr bool test() { test(); #ifndef TEST_HAS_NO_WIDE_CHARACTERS test(); #endif return true; } int main(int, char**) { test(); static_assert(test()); return 0; }