gcc/libstdc++-v3/testsuite/24_iterators
Jonathan Wakely 3e52eb28c5
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>
2025-03-27 11:14:52 +00:00
..
associated_types Update copyright years. 2025-01-02 11:59:57 +01:00
back_insert_iterator Update copyright years. 2025-01-02 11:59:57 +01:00
bidirectional Update copyright years. 2025-01-02 11:59:57 +01:00
common_iterator libstdc++: Add testcases for resolved bug [PR101527] 2025-03-24 21:38:07 +00:00
const_iterator libstdc++: Fix constraint recursion in basic_const_iterator relops [PR112490] 2025-02-28 09:39:57 -05:00
contiguous Update copyright years. 2025-01-02 11:59:57 +01:00
counted_iterator libstdc++: Add testcases for resolved bug [PR101527] 2025-03-24 21:38:07 +00:00
customization_points libstdc++: Fix std::ranges::iter_move for function references [PR119469] 2025-03-27 11:14:52 +00:00
forward Update copyright years. 2025-01-02 11:59:57 +01:00
front_insert_iterator Update copyright years. 2025-01-02 11:59:57 +01:00
headers/iterator libstdc++: Add conditional noexcept to remaining range access functions 2025-02-15 10:58:56 +00:00
indirect_callable Update copyright years. 2025-01-02 11:59:57 +01:00
input Update copyright years. 2025-01-02 11:59:57 +01:00
insert_iterator Update copyright years. 2025-01-02 11:59:57 +01:00
istream_iterator Update copyright years. 2025-01-02 11:59:57 +01:00
istreambuf_iterator Update copyright years. 2025-01-02 11:59:57 +01:00
move_iterator Update copyright years. 2025-01-02 11:59:57 +01:00
normal_iterator Update copyright years. 2025-01-02 11:59:57 +01:00
operations Update copyright years. 2025-01-02 11:59:57 +01:00
ostream_iterator Update copyright years. 2025-01-02 11:59:57 +01:00
ostreambuf_iterator Update copyright years. 2025-01-02 11:59:57 +01:00
output Update copyright years. 2025-01-02 11:59:57 +01:00
random_access Update copyright years. 2025-01-02 11:59:57 +01:00
range_access Update copyright years. 2025-01-02 11:59:57 +01:00
range_generators Update copyright years. 2025-01-02 11:59:57 +01:00
range_operations Update copyright years. 2025-01-02 11:59:57 +01:00
reverse_iterator Update copyright years. 2025-01-02 11:59:57 +01:00
aliases.cc Update copyright years. 2025-01-02 11:59:57 +01:00
container_access.cc Update copyright years. 2025-01-02 11:59:57 +01:00