[PATCH] libstdc++: Implement P1789R3 - Library Support for Expansion Statements
Tomasz Kaminski
tkaminsk@redhat.com
Wed Nov 12 10:07:23 GMT 2025
Thank you for the contribution, the patch looks good, but I have few
comments.
Also could you consider using git-send patch, so the patch content is
included in the e-mail?
Just to confirm, you are using the Signed-off tag in the meaning described
here: https://gcc.gnu.org/contribute.html#legal?
A) For the commit title, and commit message, I would suggest to describe
what was changed,
instead of referring to paper, whose title does not really describe
changes, something like:
libstdc++: Implement structured binding support for integer_sequence.
This patch implements P1789R3 Library Support for Expansion Statements [1].
[1] Link to paper.
B) For the static messages, we prefer them to include "must" do
something like:
+ static_assert(_Idx < sizeof...(_Num),
+ "index must be in range");
And would simply remove the message.
C) Fo the test:
1) I would name the test based on the functionality test, not paper, so
something like
structured_binding.cc and not p1789.cc. I do not expect reading paper
number.
2) Please consider removing the copyright assignment header, entirely
+// Copyright (C) 2013-2025 Free Software Foundation, Inc.
If you are contributing under DCO, then the copyright are not owned by FSF.
3) I do not think there is benefit in static assert having messages,
consider removing them.
4) I would also suggest creating
separate integer_sequence/structure_binding_neg
test that would contain ill-formed cases:
+static_assert( std::is_same_v<std::tuple_element_t<0, empty>, int> , "" );
// { dg-error "here" }
+static_assert( std::is_same_v<std::tuple_element_t<0, const empty>, int> ,
"" ); // { dg-error "here" }
+
+// { dg-error "static assertion failed" "" { target *-*-* } 0 }
I would also add simple call to get, on empty:
empty e;
int x = e.get<0>();
To tht file.
On Sun, Nov 9, 2025 at 1:33 AM Matthias Wippich <mfwippich@gmail.com> wrote:
> The attached patch implements P1789R3 by making std::integer_sequence
> decomposable. This paper was approved for inclusion in C++26 by LWG motion
> 14 of the 2025 Kona meeting.
>
> Tested on x86_64-linux locally.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20251112/625419d6/attachment.htm>
More information about the Libstdc++
mailing list