diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2025-03-26 11:21:32 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2025-03-27 11:14:52 +0000 |
commit | 3e52eb28c537aaa03afb78ef9dff8325c5f41f78 (patch) | |
tree | 3b12c6075086db1b39cf1473000589cc149cd1f4 /libcpp | |
parent | b631ff45f231db55b28b4c92cf1a1b46b3638ddd (diff) | |
download | gcc-3e52eb28c537aaa03afb78ef9dff8325c5f41f78.zip gcc-3e52eb28c537aaa03afb78ef9dff8325c5f41f78.tar.gz gcc-3e52eb28c537aaa03afb78ef9dff8325c5f41f78.tar.bz2 |
libstdc++: Fix std::ranges::iter_move for function references [PR119469]
The result of std::move (or a cast to an rvalue reference) on a function
reference is always an lvalue. Because std::ranges::iter_move was using
the type std::remove_reference_t<X>&& as the result of std::move, it was
giving the wrong type for function references. Use a decltype-specifier
with declval<remove_reference_t<X>>() instead of just using the
remove_reference_t<X>&& type directly. This gives the right result,
while still avoiding the cost of doing overload resolution for
std::move.
libstdc++-v3/ChangeLog:
PR libstdc++/119469
* include/bits/iterator_concepts.h (_IterMove::__result): Use
decltype-specifier instead of an explicit type.
* testsuite/24_iterators/customization_points/iter_move.cc:
Check results for function references.
Reviewed-by: Tomasz KamiĆski <tkaminsk@redhat.com>
Diffstat (limited to 'libcpp')
0 files changed, 0 insertions, 0 deletions