diff --git a/libcxx/docs/Status/Cxx20Papers.csv b/libcxx/docs/Status/Cxx20Papers.csv --- a/libcxx/docs/Status/Cxx20Papers.csv +++ b/libcxx/docs/Status/Cxx20Papers.csv @@ -196,7 +196,7 @@ "`P2231R1 `__","LWG","Missing constexpr in std::optional and std::variant","June 2021","|In progress|","13.0" "`P2325R3 `__","LWG","Views should not be required to be default constructible","June 2021","|In progress|","" "`P2210R2 `__","LWG",Superior String Splitting,"June 2021","","" -"`P2216R3 `__","LWG",std::format improvements,"June 2021","","" +"`P2216R3 `__","LWG",std::format improvements,"June 2021","|Partial|","" "`P2281R1 `__","LWG",Clarifying range adaptor objects,"June 2021","","" "`P2328R1 `__","LWG",join_view should join all views of ranges,"June 2021","","" "`P2367R0 `__","LWG",Remove misuses of list-initialization from Clause 24,"June 2021","","" diff --git a/libcxx/include/format b/libcxx/include/format --- a/libcxx/include/format +++ b/libcxx/include/format @@ -51,9 +51,6 @@ using wformat_args = basic_format_args; - template - using format_args_t = basic_format_args>; - // [format.functions], formatting functions template string format(string_view fmt, const Args&... args); @@ -79,17 +76,15 @@ Out format_to(Out out, const locale& loc, wstring_view fmt, const Args&... args); template - Out vformat_to(Out out, string_view fmt, - format_args_t, char> args); + Out vformat_to(Out out, string_view fmt, format_args args); template - Out vformat_to(Out out, wstring_view fmt, - format_args_t, wchar_t> args); + Out vformat_to(Out out, wstring_view fmt, wformat_args args); template Out vformat_to(Out out, const locale& loc, string_view fmt, - format_args_t, char> args); + format_args char> args); template Out vformat_to(Out out, const locale& loc, wstring_view fmt, - format_args_t, wchar_t> args); + wformat_args args); template struct format_to_n_result { Out out; @@ -322,9 +317,6 @@ using wformat_args = basic_format_args; #endif -template -using format_args_t = basic_format_args>; - template struct _LIBCPP_TEMPLATE_VIS __format_arg_store { // TODO FMT Use a built-in array. @@ -378,8 +370,7 @@ template _LIBCPP_HIDDEN auto __handle_format(_Uv __value, auto& __ctx) - -> decltype(__ctx.out()) - { + -> decltype(__ctx.out()) { // TODO FMT Implement using formatting arguments // TODO FMT Improve PoC since using std::to_string is inefficient. // Note the code doesn't use std::string::iterator since the unit tests @@ -505,27 +496,34 @@ } // namespace __format -template +template requires(output_iterator<_OutIt, const _CharT&>) _LIBCPP_HIDE_FROM_ABI _OutIt - __vformat_to(_OutIt __out_it, basic_string_view<_CharT> __fmt, - format_args_t, _CharT> __args) { - return __format::__vformat_to( - basic_format_parse_context{__fmt, __args.__size()}, - _VSTD::__format_context_create(_VSTD::move(__out_it), __args)); + __vformat_to( + _OutIt __out_it, basic_string_view<_CharT> __fmt, + basic_format_args> __args) { + if constexpr (same_as<_OutIt, _FormatOutIt>) + return _VSTD::__format::__vformat_to( + basic_format_parse_context{__fmt, __args.__size()}, + _VSTD::__format_context_create(_VSTD::move(__out_it), __args)); + else { + basic_string<_CharT> __str; + _VSTD::__format::__vformat_to( + basic_format_parse_context{__fmt, __args.__size()}, + _VSTD::__format_context_create(_VSTD::back_inserter(__str), __args)); + return _VSTD::copy_n(__str.begin(), __str.size(), _VSTD::move(__out_it)); + } } template _OutIt> _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt -vformat_to(_OutIt __out_it, string_view __fmt, - format_args_t, char> __args) { +vformat_to(_OutIt __out_it, string_view __fmt, format_args __args) { return _VSTD::__vformat_to(_VSTD::move(__out_it), __fmt, __args); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template _OutIt> _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt -vformat_to(_OutIt __out_it, wstring_view __fmt, - format_args_t, wchar_t> __args) { +vformat_to(_OutIt __out_it, wstring_view __fmt, wformat_args __args) { return _VSTD::__vformat_to(_VSTD::move(__out_it), __fmt, __args); } #endif @@ -533,19 +531,16 @@ template _OutIt, class... _Args> _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt format_to(_OutIt __out_it, string_view __fmt, const _Args&... __args) { - return _VSTD::vformat_to( - _VSTD::move(__out_it), __fmt, - _VSTD::make_format_args>(__args...)); + return _VSTD::vformat_to(_VSTD::move(__out_it), __fmt, + _VSTD::make_format_args(__args...)); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template _OutIt, class... _Args> _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt format_to(_OutIt __out_it, wstring_view __fmt, const _Args&... __args) { - return _VSTD::vformat_to( - _VSTD::move(__out_it), __fmt, - _VSTD::make_format_args>( - __args...)); + return _VSTD::vformat_to(_VSTD::move(__out_it), __fmt, + _VSTD::make_wformat_args(__args...)); } #endif @@ -631,29 +626,37 @@ #ifndef _LIBCPP_HAS_NO_LOCALIZATION -template +template requires(output_iterator<_OutIt, const _CharT&>) _LIBCPP_HIDE_FROM_ABI _OutIt - __vformat_to(_OutIt __out_it, locale __loc, basic_string_view<_CharT> __fmt, - format_args_t, _CharT> __args) { - return __format::__vformat_to( - basic_format_parse_context{__fmt, __args.__size()}, - _VSTD::__format_context_create(_VSTD::move(__out_it), __args, - _VSTD::move(__loc))); + __vformat_to( + _OutIt __out_it, locale __loc, basic_string_view<_CharT> __fmt, + basic_format_args> __args) { + if constexpr (same_as<_OutIt, _FormatOutIt>) + return _VSTD::__format::__vformat_to( + basic_format_parse_context{__fmt, __args.__size()}, + _VSTD::__format_context_create(_VSTD::move(__out_it), __args, + _VSTD::move(__loc))); + else { + basic_string<_CharT> __str; + _VSTD::__format::__vformat_to( + basic_format_parse_context{__fmt, __args.__size()}, + _VSTD::__format_context_create(_VSTD::back_inserter(__str), __args, + _VSTD::move(__loc))); + return _VSTD::copy_n(__str.begin(), __str.size(), _VSTD::move(__out_it)); + } } template _OutIt> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt -vformat_to(_OutIt __out_it, locale __loc, string_view __fmt, - format_args_t, char> __args) { +_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt vformat_to( + _OutIt __out_it, locale __loc, string_view __fmt, format_args __args) { return _VSTD::__vformat_to(_VSTD::move(__out_it), _VSTD::move(__loc), __fmt, __args); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template _OutIt> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt -vformat_to(_OutIt __out_it, locale __loc, wstring_view __fmt, - format_args_t, wchar_t> __args) { +_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt vformat_to( + _OutIt __out_it, locale __loc, wstring_view __fmt, wformat_args __args) { return _VSTD::__vformat_to(_VSTD::move(__out_it), _VSTD::move(__loc), __fmt, __args); } @@ -662,19 +665,16 @@ template _OutIt, class... _Args> _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt format_to( _OutIt __out_it, locale __loc, string_view __fmt, const _Args&... __args) { - return _VSTD::vformat_to( - _VSTD::move(__out_it), _VSTD::move(__loc), __fmt, - _VSTD::make_format_args>(__args...)); + return _VSTD::vformat_to(_VSTD::move(__out_it), _VSTD::move(__loc), __fmt, + _VSTD::make_format_args(__args...)); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template _OutIt, class... _Args> _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt format_to( _OutIt __out_it, locale __loc, wstring_view __fmt, const _Args&... __args) { - return _VSTD::vformat_to( - _VSTD::move(__out_it), _VSTD::move(__loc), __fmt, - _VSTD::make_format_args>( - __args...)); + return _VSTD::vformat_to(_VSTD::move(__out_it), _VSTD::move(__loc), __fmt, + _VSTD::make_wformat_args(__args...)); } #endif diff --git a/libcxx/include/version b/libcxx/include/version --- a/libcxx/include/version +++ b/libcxx/include/version @@ -72,7 +72,7 @@ __cpp_lib_execution 201902L 201603L // C++17 __cpp_lib_filesystem 201703L -__cpp_lib_format 201907L +__cpp_lib_format 202106L __cpp_lib_gcd_lcm 201606L __cpp_lib_generic_associative_lookup 201304L __cpp_lib_generic_unordered_lookup 201811L @@ -314,7 +314,7 @@ # undef __cpp_lib_execution // # define __cpp_lib_execution 201902L # if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format) -// # define __cpp_lib_format 201907L +// # define __cpp_lib_format 202106L # endif # define __cpp_lib_generic_unordered_lookup 201811L # define __cpp_lib_int_pow2 202002L diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/format.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/format.version.pass.cpp --- a/libcxx/test/std/language.support/support.limits/support.limits.general/format.version.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/format.version.pass.cpp @@ -18,7 +18,7 @@ // Test the feature test macros defined by /* Constant Value - __cpp_lib_format 201907L [C++20] + __cpp_lib_format 202106L [C++20] */ #include @@ -48,8 +48,8 @@ # ifndef __cpp_lib_format # error "__cpp_lib_format should be defined in c++20" # endif -# if __cpp_lib_format != 201907L -# error "__cpp_lib_format should have the value 201907L in c++20" +# if __cpp_lib_format != 202106L +# error "__cpp_lib_format should have the value 202106L in c++20" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_format @@ -63,8 +63,8 @@ # ifndef __cpp_lib_format # error "__cpp_lib_format should be defined in c++2b" # endif -# if __cpp_lib_format != 201907L -# error "__cpp_lib_format should have the value 201907L in c++2b" +# if __cpp_lib_format != 202106L +# error "__cpp_lib_format should have the value 202106L in c++2b" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_format diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp --- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp @@ -67,7 +67,7 @@ __cpp_lib_execution 201603L [C++17] 201902L [C++20] __cpp_lib_filesystem 201703L [C++17] - __cpp_lib_format 201907L [C++20] + __cpp_lib_format 202106L [C++20] __cpp_lib_gcd_lcm 201606L [C++17] __cpp_lib_generic_associative_lookup 201304L [C++14] __cpp_lib_generic_unordered_lookup 201811L [C++20] @@ -2546,8 +2546,8 @@ # ifndef __cpp_lib_format # error "__cpp_lib_format should be defined in c++20" # endif -# if __cpp_lib_format != 201907L -# error "__cpp_lib_format should have the value 201907L in c++20" +# if __cpp_lib_format != 202106L +# error "__cpp_lib_format should have the value 202106L in c++20" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_format @@ -3697,8 +3697,8 @@ # ifndef __cpp_lib_format # error "__cpp_lib_format should be defined in c++2b" # endif -# if __cpp_lib_format != 201907L -# error "__cpp_lib_format should have the value 201907L in c++2b" +# if __cpp_lib_format != 202106L +# error "__cpp_lib_format should have the value 202106L in c++2b" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_format diff --git a/libcxx/test/std/utilities/format/format.arguments/format.arg.store/make_format_args.sh.cpp b/libcxx/test/std/utilities/format/format.arguments/format.arg.store/make_format_args.sh.cpp --- a/libcxx/test/std/utilities/format/format.arguments/format.arg.store/make_format_args.sh.cpp +++ b/libcxx/test/std/utilities/format/format.arguments/format.arg.store/make_format_args.sh.cpp @@ -20,6 +20,7 @@ // - otherwise, if T is char and char_type is wchar_t, initializes value with static_cast(v); #include +#include void test() { std::make_format_args; // using wformat_args = basic_format_args; -// template -// using format_args_t = basic_format_args>; #include #include @@ -30,24 +28,5 @@ std::basic_format_args>); #endif -static_assert(std::is_same_v< - std::format_args_t, char>, - std::basic_format_args, char>>>); - -#ifndef TEST_HAS_NO_WIDE_CHARACTERS -static_assert( - std::is_same_v< - std::format_args_t, wchar_t>, - std::basic_format_args, wchar_t>>>); -#endif - -static_assert( - std::is_same_v< - std::format_args_t>, char>, - std::basic_format_args>, char>>>); - // Required for MSVC internal test runner compatibility. int main(int, char**) { return 0; } diff --git a/libcxx/test/std/utilities/format/format.functions/format_tests.h b/libcxx/test/std/utilities/format/format.functions/format_tests.h --- a/libcxx/test/std/utilities/format/format.functions/format_tests.h +++ b/libcxx/test/std/utilities/format/format.functions/format_tests.h @@ -8,6 +8,8 @@ #ifndef TEST_STD_UTILITIES_FORMAT_FORMAT_FUNCTIONS_FORMAT_TESTS_H #define TEST_STD_UTILITIES_FORMAT_FORMAT_FUNCTIONS_FORMAT_TESTS_H +#include + #include "make_string.h" // In this file the following template types are used: @@ -17,6 +19,24 @@ #define STR(S) MAKE_STRING(CharT, S) #define CSTR(S) MAKE_CSTRING(CharT, S) +template +struct context {}; + +template <> +struct context { + using type = std::format_context; +}; + +#ifndef TEST_HAS_NO_WIDE_CHARACTERS +template <> +struct context { + using type = std::wformat_context; +}; +#endif + +template +using context_t = typename context::type; + template std::vector> invalid_types(std::string valid) { std::vector> result; diff --git a/libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp b/libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp @@ -49,17 +49,15 @@ // Out format_to(Out out, const locale& loc, wstring_view fmt, const Args&... args); // // template -// Out vformat_to(Out out, string_view fmt, -// format_args_t, char> args); +// Out vformat_to(Out out, string_view fmt, format_args args); // template -// Out vformat_to(Out out, wstring_view fmt, -// format_args_t, wchar_t> args); +// Out vformat_to(Out out, wstring_view fmt, wformat_args args); // template // Out vformat_to(Out out, const locale& loc, string_view fmt, -// format_args_t, char> args); +// format_args args); // template // Out vformat_to(Out out, const locale& loc, wstring_view fmt, -// format_args_t, wchar_t> args); +// wformat_arg args); // // template struct format_to_n_result { // Out out; @@ -98,6 +96,7 @@ #include "test_macros.h" #include "make_string.h" #include "platform_support.h" // locale name macros +#include "format_tests.h" #define STR(S) MAKE_STRING(CharT, S) @@ -138,10 +137,8 @@ } // *** vformat *** { - std::basic_string out = std::vformat( - fmt, std::make_format_args>, CharT>>( - args...)); + std::basic_string out = + std::vformat(fmt, std::make_format_args>(args...)); assert(out == expected); } // *** format_to *** @@ -154,10 +151,8 @@ // *** vformat_to *** { std::basic_string out(expected.size(), CharT(' ')); - auto it = std::vformat_to( - out.begin(), fmt, - std::make_format_args::iterator, CharT>>(args...)); + auto it = std::vformat_to(out.begin(), fmt, + std::make_format_args>(args...)); assert(it == out.end()); assert(out == expected); } @@ -195,10 +190,7 @@ // *** vformat *** { std::basic_string out = std::vformat( - loc, fmt, - std::make_format_args>, CharT>>( - args...)); + loc, fmt, std::make_format_args>(args...)); assert(out == expected); } // *** format_to *** @@ -211,10 +203,8 @@ // *** vformat_to *** { std::basic_string out(expected.size(), CharT(' ')); - auto it = std::vformat_to( - out.begin(), loc, fmt, - std::make_format_args::iterator, CharT>>(args...)); + auto it = std::vformat_to(out.begin(), loc, fmt, + std::make_format_args>(args...)); assert(it == out.end()); assert(out == expected); } diff --git a/libcxx/test/std/utilities/format/format.functions/vformat.locale.pass.cpp b/libcxx/test/std/utilities/format/format.functions/vformat.locale.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/vformat.locale.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/vformat.locale.pass.cpp @@ -28,10 +28,7 @@ std::basic_string fmt, const Args&... args) { std::basic_string out = std::vformat( - std::locale(), fmt, - std::make_format_args>, CharT>>( - args...)); + std::locale(), fmt, std::make_format_args>(args...)); assert(out == expected); }; @@ -39,11 +36,8 @@ std::string_view what, std::basic_string fmt, const Args&... args) { #ifndef TEST_HAS_NO_EXCEPTIONS try { - std::vformat( - std::locale(), fmt, - std::make_format_args>, CharT>>( - args...)); + std::vformat(std::locale(), fmt, + std::make_format_args>(args...)); assert(false); } catch (std::format_error& e) { LIBCPP_ASSERT(e.what() == what); diff --git a/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp b/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp @@ -26,10 +26,8 @@ auto test = [](std::basic_string expected, std::basic_string fmt, const Args&... args) { - std::basic_string out = std::vformat( - fmt, std::make_format_args>, CharT>>( - args...)); + std::basic_string out = + std::vformat(fmt, std::make_format_args>(args...)); assert(out == expected); }; @@ -37,10 +35,7 @@ std::string_view what, std::basic_string fmt, const Args&... args) { #ifndef TEST_HAS_NO_EXCEPTIONS try { - std::vformat( - fmt, std::make_format_args>, CharT>>( - args...)); + std::vformat(fmt, std::make_format_args>(args...)); assert(false); } catch (std::format_error& e) { LIBCPP_ASSERT(e.what() == what); diff --git a/libcxx/test/std/utilities/format/format.functions/vformat_to.locale.pass.cpp b/libcxx/test/std/utilities/format/format.functions/vformat_to.locale.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/vformat_to.locale.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/vformat_to.locale.pass.cpp @@ -16,10 +16,10 @@ // template // Out vformat_to(Out out, const locale& loc, string_view fmt, -// format_args_t, char> args); +// format_args args); // template // Out vformat_to(Out out, const locale& loc, wstring_view fmt, -// format_args_t, wchar_t> args); +// wformat_args args); #include #include @@ -35,38 +35,31 @@ const Args&... args) { { std::basic_string out(expected.size(), CharT(' ')); - auto it = std::vformat_to( - out.begin(), std::locale(), fmt, - std::make_format_args::iterator, CharT>>(args...)); + auto it = std::vformat_to(out.begin(), std::locale(), fmt, + std::make_format_args>(args...)); assert(it == out.end()); assert(out == expected); } { std::list out; - std::vformat_to( - std::back_inserter(out), std::locale(), fmt, - std::make_format_args>, CharT>>(args...)); + std::vformat_to(std::back_inserter(out), std::locale(), fmt, + std::make_format_args>(args...)); assert( std::equal(out.begin(), out.end(), expected.begin(), expected.end())); } { std::vector out; - std::vformat_to( - std::back_inserter(out), std::locale(), fmt, - std::make_format_args>, CharT>>(args...)); + std::vformat_to(std::back_inserter(out), std::locale(), fmt, + std::make_format_args>(args...)); assert( std::equal(out.begin(), out.end(), expected.begin(), expected.end())); } { assert(expected.size() < 4096 && "Update the size of the buffer."); CharT out[4096]; - CharT* it = std::vformat_to( - out, std::locale(), fmt, - std::make_format_args>( - args...)); + CharT* it = + std::vformat_to(out, std::locale(), fmt, + std::make_format_args>(args...)); assert(std::distance(out, it) == int(expected.size())); // Convert to std::string since output contains '\0' for boolean tests. assert(std::basic_string(out, it) == expected); @@ -78,11 +71,8 @@ #ifndef TEST_HAS_NO_EXCEPTIONS try { std::basic_string out; - std::vformat_to( - std::back_inserter(out), std::locale(), fmt, - std::make_format_args>, CharT>>( - args...)); + std::vformat_to(std::back_inserter(out), std::locale(), fmt, + std::make_format_args>(args...)); assert(false); } catch (std::format_error& e) { LIBCPP_ASSERT(e.what() == what); diff --git a/libcxx/test/std/utilities/format/format.functions/vformat_to.pass.cpp b/libcxx/test/std/utilities/format/format.functions/vformat_to.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/vformat_to.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/vformat_to.pass.cpp @@ -18,11 +18,9 @@ // // template -// Out vformat_to(Out out, string_view fmt, -// format_args_t, char> args); +// Out vformat_to(Out out, string_view fmt, format_args args); // template -// Out vformat_to(Out out, wstring_view fmt, -// format_args_t, wchar_t> args); +// Out vformat_to(Out out, wstring_view fmt, wformat_args_t args); #include #include @@ -38,28 +36,22 @@ const Args&... args) { { std::basic_string out(expected.size(), CharT(' ')); - auto it = std::vformat_to( - out.begin(), fmt, - std::make_format_args::iterator, CharT>>(args...)); + auto it = std::vformat_to(out.begin(), fmt, + std::make_format_args>(args...)); assert(it == out.end()); assert(out == expected); } { std::list out; - std::vformat_to( - std::back_inserter(out), fmt, - std::make_format_args>, CharT>>(args...)); + std::vformat_to(std::back_inserter(out), fmt, + std::make_format_args>(args...)); assert( std::equal(out.begin(), out.end(), expected.begin(), expected.end())); } { std::vector out; - std::vformat_to( - std::back_inserter(out), fmt, - std::make_format_args>, CharT>>(args...)); + std::vformat_to(std::back_inserter(out), fmt, + std::make_format_args>(args...)); assert( std::equal(out.begin(), out.end(), expected.begin(), expected.end())); } @@ -67,9 +59,7 @@ assert(expected.size() < 4096 && "Update the size of the buffer."); CharT out[4096]; CharT* it = std::vformat_to( - out, fmt, - std::make_format_args>( - args...)); + out, fmt, std::make_format_args>(args...)); assert(std::distance(out, it) == int(expected.size())); // Convert to std::string since output contains '\0' for boolean tests. assert(std::basic_string(out, it) == expected); @@ -81,11 +71,8 @@ #ifndef TEST_HAS_NO_EXCEPTIONS try { std::basic_string out; - std::vformat_to( - std::back_inserter(out), fmt, - std::make_format_args>, CharT>>( - args...)); + std::vformat_to(std::back_inserter(out), fmt, + std::make_format_args>(args...)); assert(false); } catch (std::format_error& e) { LIBCPP_ASSERT(e.what() == what); diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py --- a/libcxx/utils/generate_feature_test_macro_components.py +++ b/libcxx/utils/generate_feature_test_macro_components.py @@ -294,7 +294,7 @@ "libcxx_guard": "!defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem)" }, { "name": "__cpp_lib_format", - "values": { "c++20": 201907 }, + "values": { "c++20": 202106 }, "headers": ["format"], "test_suite_guard": "!defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format)", "libcxx_guard": "!defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format)",