Tested x86_64-linux. Pushed to trunk. -- >8 --
There's no valid use case for default constructing this type, so the committee approved removing the default constructor. libstdc++-v3/ChangeLog: * include/std/format (basic_format_args): Remove default constructor, as per LWG 4106. * testsuite/std/format/arguments/args.cc: Check it isn't default constructible. --- libstdc++-v3/include/std/format | 2 -- libstdc++-v3/testsuite/std/format/arguments/args.cc | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format index 16cee0d3c74..8f6a82a1fd4 100644 --- a/libstdc++-v3/include/std/format +++ b/libstdc++-v3/include/std/format @@ -3667,8 +3667,6 @@ namespace __format { return {_Format_arg::template _S_to_enum<_Args>()...}; } public: - basic_format_args() noexcept = default; - template<typename... _Args> basic_format_args(const _Store<_Args...>& __store) noexcept; diff --git a/libstdc++-v3/testsuite/std/format/arguments/args.cc b/libstdc++-v3/testsuite/std/format/arguments/args.cc index eba129ff894..16ca71caecb 100644 --- a/libstdc++-v3/testsuite/std/format/arguments/args.cc +++ b/libstdc++-v3/testsuite/std/format/arguments/args.cc @@ -3,6 +3,10 @@ #include <format> #include <testsuite_hooks.h> +// LWG 4106. basic_format_args should not be default-constructible +static_assert( ! std::is_default_constructible_v<std::format_args> ); +static_assert( ! std::is_default_constructible_v<std::wformat_args> ); + template<typename Ctx, typename T> bool equals(std::basic_format_arg<Ctx> fmt_arg, T expected) { return std::visit_format_arg([=](auto arg_val) { -- 2.45.2