diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2024-11-14 10:50:34 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2024-11-14 15:39:03 +0000 |
commit | f91e34644e66b2eb7f4930f17a30da9f49e7d4d2 (patch) | |
tree | ba36f0c7c832be0603a04f3543e35f36568a877c /libstdc++-v3/testsuite | |
parent | dec2158b2c39285a561a035ca383128c5c41ecf0 (diff) | |
download | gcc-f91e34644e66b2eb7f4930f17a30da9f49e7d4d2.zip gcc-f91e34644e66b2eb7f4930f17a30da9f49e7d4d2.tar.gz gcc-f91e34644e66b2eb7f4930f17a30da9f49e7d4d2.tar.bz2 |
libstdc++: Add missing constraint to operator+ for std::move_iterator
This constraint was added by the One Ranges proposal (P0896R4) and
then fixed by LWG 3293, but it was missing from libstdc++.
libstdc++-v3/ChangeLog:
* include/bits/stl_iterator.h (operator+): Add constraint to
move_iterator operator.
* testsuite/24_iterators/move_iterator/rel_ops_c++20.cc:
Diffstat (limited to 'libstdc++-v3/testsuite')
-rw-r--r-- | libstdc++-v3/testsuite/24_iterators/move_iterator/rel_ops_c++20.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/24_iterators/move_iterator/rel_ops_c++20.cc b/libstdc++-v3/testsuite/24_iterators/move_iterator/rel_ops_c++20.cc index b2c1fe0..deb1772 100644 --- a/libstdc++-v3/testsuite/24_iterators/move_iterator/rel_ops_c++20.cc +++ b/libstdc++-v3/testsuite/24_iterators/move_iterator/rel_ops_c++20.cc @@ -18,6 +18,7 @@ // { dg-do compile { target c++20 } } #include <iterator> +#include <testsuite_iterators.h> template<int> struct Iter @@ -141,3 +142,14 @@ static_assert( cend > beg ); static_assert( beg <= cend ); static_assert( cend >= beg ); static_assert( std::is_lt(beg <=> cend) ); + +template<typename I> + concept has_plus = requires(std::iter_difference_t<I> n, I i) { + { n + i } -> std::same_as<I>; + }; + +using namespace __gnu_test; +using MBI = std::move_iterator<bidirectional_iterator_wrapper<int>>; +static_assert( ! has_plus<MBI> ); +using MRI = std::move_iterator<random_access_iterator_wrapper<int>>; +static_assert( has_plus<MRI> ); |