libstdc++: Replace deduced return type in ranges::iter_move (PR 92894)
authorJonathan Wakely <jwakely@redhat.com>
Fri, 1 May 2020 13:27:25 +0000 (14:27 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 1 May 2020 13:27:25 +0000 (14:27 +0100)
commita5f2fb1ff1742685a91dfdf78da871fd4d3292e5
treeb544e703bf229eb499608901a003e494390166b3
parent070b4df8a06539b661c134d436ea4207099fdcf0
libstdc++: Replace deduced return type in ranges::iter_move (PR 92894)

The deduced return type causes the instantiation of the function body,
which can then require the instantiation of std::projected::operator*
which is intentionally not defined.

This patch uses a helper trait to define the return type, so that the
function body doesn't need to be instantiated. That helper trait can
then also be used in other places that currently check the return type
of ranges::iter_move (iter_rvalue_reference_t and indirectly_readable).

2020-05-01  Jonathan Wakely  <jwakely@redhat.com>
    Patrick Palka  <ppalka@redhat.com>

PR libstdc++/92894
* include/bits/iterator_concepts.h (ranges::__cust_imove::_IMove):
Add trait to determine return type and an alias for it.
(ranges::__cust_imove::_IMove::operator()): Use __result instead of
deduced return type.
(iter_rvalue_reference_t): Use _IMove::__type instead of checking
the result of ranges::iter_move.
(__detail::__indirectly_readable_impl): Use iter_rvalue_reference_t
instead of checking the result of ranges::iter_move.
* testsuite/24_iterators/customization_points/92894.cc: New test.
* testsuite/24_iterators/indirect_callable/92894.cc: New test.
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/iterator_concepts.h
libstdc++-v3/testsuite/24_iterators/customization_points/92894.cc [new file with mode: 0644]
libstdc++-v3/testsuite/24_iterators/indirect_callable/92894.cc [new file with mode: 0644]