Skip to content

Commit 96c9913

Browse files
[libc++][format] LWG4106: basic_format_args should not be default-constructible (#97250)
See [LWG4106](https://cplusplus.github.io/LWG/issue4106) and [P3341R0](https://wg21.link/p3341r0). The test coverage for the empty state of `basic_format_args` in `get.pass.cpp` is to be completely removed, because the non-default-constructibility is covered in `ctor.pass.cpp`.
1 parent 29896db commit 96c9913

File tree

4 files changed

+4
-17
lines changed

4 files changed

+4
-17
lines changed

libcxx/docs/Status/Cxx2cIssues.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"`4096 <https://wg21.link/LWG4096>`__","``views::iota(views::iota(0))`` should be rejected","St. Louis June 2024","","","|ranges|"
7575
"`4098 <https://wg21.link/LWG4098>`__","``views::adjacent<0>`` should reject non-forward ranges","St. Louis June 2024","","","|ranges|"
7676
"`4105 <https://wg21.link/LWG4105>`__","``ranges::ends_with``\`s Returns misses difference casting","St. Louis June 2024","","","|ranges|"
77-
"`4106 <https://wg21.link/LWG4106>`__","``basic_format_args`` should not be default-constructible","St. Louis June 2024","","","|format|"
77+
"`4106 <https://wg21.link/LWG4106>`__","``basic_format_args`` should not be default-constructible","St. Louis June 2024","|Complete|","19.0","|format|"
7878
"","","","","",""
7979
"`3343 <https://wg21.link/LWG3343>`__","Ordering of calls to ``unlock()`` and ``notify_all()`` in Effects element of ``notify_all_at_thread_exit()`` should be reversed","Not Yet Adopted","|Complete|","16.0",""
8080
"XXXX","","The sys_info range should be affected by save","Not Yet Adopted","|Complete|","19.0"

libcxx/include/__format/format_args.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2828
template <class _Context>
2929
class _LIBCPP_TEMPLATE_VIS basic_format_args {
3030
public:
31-
basic_format_args() noexcept = default;
32-
3331
template <class... _Args>
3432
_LIBCPP_HIDE_FROM_ABI basic_format_args(const __format_arg_store<_Context, _Args...>& __store) noexcept
3533
: __size_(sizeof...(_Args)) {

libcxx/test/std/utilities/format/format.arguments/format.args/ctor.pass.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99

1010
// <format>
1111

12-
// basic_format_args() noexcept;
1312
// template<class... Args>
1413
// basic_format_args(const format-arg-store<Context, Args...>& store) noexcept;
1514

1615
#include <format>
1716
#include <cassert>
17+
#include <type_traits>
1818

1919
#include "test_macros.h"
2020

@@ -24,12 +24,7 @@ void test() {
2424
char c = 'c';
2525
nullptr_t p = nullptr;
2626
using Context = std::basic_format_context<CharT*, CharT>;
27-
{
28-
ASSERT_NOEXCEPT(std::basic_format_args<Context>{});
29-
30-
std::basic_format_args<Context> format_args{};
31-
assert(!format_args.get(0));
32-
}
27+
static_assert(!std::is_default_constructible_v<std::basic_format_args<Context>>);
3328
{
3429
auto store = std::make_format_args<Context>(i);
3530
ASSERT_NOEXCEPT(std::basic_format_args<Context>{store});

libcxx/test/std/utilities/format/format.arguments/format.args/get.pass.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,7 @@ void test_string_view(From value) {
8181

8282
template <class CharT>
8383
void test() {
84-
using Context = std::basic_format_context<CharT*, CharT>;
85-
{
86-
const std::basic_format_args<Context> format_args{};
87-
ASSERT_NOEXCEPT(format_args.get(0));
88-
assert(!format_args.get(0));
89-
}
90-
84+
using Context = std::basic_format_context<CharT*, CharT>;
9185
using char_type = typename Context::char_type;
9286
std::basic_string<char_type> empty;
9387
std::basic_string<char_type> str = MAKE_STRING(char_type, "abc");

0 commit comments

Comments
 (0)