]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Fix ranges::iter_move handling of rvalues [PR106612]
authorJonathan Wakely <jwakely@redhat.com>
Fri, 28 Feb 2025 21:44:41 +0000 (21:44 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Fri, 28 Feb 2025 21:48:01 +0000 (21:48 +0000)
commita8ee522c5923ba17851e4b71316a2dff19d6368f
treea10615e87f9a9bab7a2b4e1f3d4cb3fd543ca5a7
parent3866ca796d5281d33f25b4165badacf8f198c6d1
libstdc++: Fix ranges::iter_move handling of rvalues [PR106612]

The specification for std::ranges::iter_move apparently requires us to
handle types which do not satisfy std::indirectly_readable, for example
with overloaded operator* which behaves differently for different value
categories.

libstdc++-v3/ChangeLog:

PR libstdc++/106612
* include/bits/iterator_concepts.h (_IterMove::__iter_ref_t):
New alias template.
(_IterMove::__result): Use __iter_ref_t instead of
std::iter_reference_t.
(_IterMove::__type): Remove incorrect __dereferenceable
constraint.
(_IterMove::operator()): Likewise. Add correct constraints. Use
__iter_ref_t instead of std::iter_reference_t. Forward parameter
as correct value category.
(iter_swap): Add comments.
* testsuite/24_iterators/customization_points/iter_move.cc: Test
that iter_move is found by ADL and that rvalue arguments are
handled correctly.

Reviewed-by: Patrick Palka <ppalka@redhat.com>
libstdc++-v3/include/bits/iterator_concepts.h
libstdc++-v3/testsuite/24_iterators/customization_points/iter_move.cc