]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Implement const copy-assignment for tuple<> [PR119721]
authorTomasz Kamiński <tkaminsk@redhat.com>
Mon, 27 Oct 2025 13:19:47 +0000 (14:19 +0100)
committerTomasz Kamiński <tkaminsk@redhat.com>
Wed, 29 Oct 2025 16:13:59 +0000 (17:13 +0100)
commit8728f60b9750ea10abd1a02db7972a6ff6ef2eae
tree47d21c3b358c09e496164580cc5810cd3bb95b9b
parent52e300124d2eaad0f19ccc0a49f95fd605a1de69
libstdc++: Implement const copy-assignment for tuple<> [PR119721]

This patch completes the implementation of P2321R2, giving tuple proper proxy
reference semantics.

The assignment operator is implemented as a template constrained to accept only
tuple<>. Consequently, the language does not consider it a copy assignment
operator, which prevents tuple<> from losing its trivially copyable status.

The _Tuple template parameter is defaulted, ensuring the operator remains
a viable candidate for assignment with an empty brace-init list.

PR libstdc++/119721

libstdc++-v3/ChangeLog:

* include/std/tuple (tuple<>::operator=(const _Tuple&) const)
[__cpp_lib_ranges_zip]: Define.
* testsuite/23_containers/tuple/cons/119721.cc: Test const
assignment.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
libstdc++-v3/include/std/tuple
libstdc++-v3/testsuite/23_containers/tuple/cons/119721.cc