[PATCH] libstdc++: Add missing P0896 changes to <iterator>

Jonathan Wakely jwakely@redhat.com
Fri Oct 2 10:37:50 GMT 2020


On 01/10/20 10:35 -0400, Patrick Palka via Libstdc++ wrote:
>I noticed that the following changes from this paper were not yet
>implemented.

Oops, thanks.

>OK to commit after testing on x86_64-pc-linux-gnu finishes successfully?
>
>libstdc++-v3/ChangeLog:
>
>	* include/bits/stl_iterator.h (reverse_iterator::iter_move):
>	Define for C++20 as per P0896.
>	(reverse_iterator::iter_swap): Likewise.
>	(move_iterator::operator*): Apply P0896 changes for C++20.
>	(move_iterator::operator[]): Likewise.
>	* testsuite/24_iterators/reverse_iterator/cust.cc: New test.
>---
> libstdc++-v3/include/bits/stl_iterator.h      | 33 ++++++++++++
> .../24_iterators/reverse_iterator/cust.cc     | 51 +++++++++++++++++++
> 2 files changed, 84 insertions(+)
> create mode 100644 libstdc++-v3/testsuite/24_iterators/reverse_iterator/cust.cc
>
>diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h
>index f29bae92706..ca3c4cda329 100644
>--- a/libstdc++-v3/include/bits/stl_iterator.h
>+++ b/libstdc++-v3/include/bits/stl_iterator.h
>@@ -362,6 +362,31 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>       operator[](difference_type __n) const
>       { return *(*this + __n); }
>
>+#if __cplusplus > 201703L && __cpp_lib_concepts
>+      friend constexpr iter_rvalue_reference_t<_Iterator>
>+      iter_move(const reverse_iterator& __i)
>+      noexcept(is_nothrow_copy_constructible_v<_Iterator>
>+	       && noexcept(ranges::iter_move(--declval<_Iterator&>())))

All the declval calls need to be std::-qualified.

OK for master and gcc-10 with that change, thanks.




More information about the Gcc-patches mailing list