1 // { dg-options "-std=gnu++20" }
2 // { dg-do compile { target c++20 } }
4 // Verify P2520R0 changes to move_iterator's iterator_concept, which we treat
5 // as a DR against C++20.
8 #if __cpp_lib_move_iterator_concept != 202207L
9 # error "Feature-test macro __cpp_lib_move_iterator_concept has wrong value in <iterator>"
12 #undef __cpp_lib_move_iterator_concept
14 #if __cpp_lib_move_iterator_concept != 202207L
15 # error "Feature-test macro __cpp_lib_move_iterator_concept has wrong value in <version>"
18 #include <testsuite_iterators.h>
20 using __gnu_test::test_input_range
;
21 using __gnu_test::test_forward_range
;
22 using __gnu_test::test_bidirectional_range
;
23 using __gnu_test::test_random_access_range
;
25 using ty1
= std::move_iterator
<decltype(std::declval
<test_input_range
<int>&>().begin())>;
26 static_assert(std::same_as
<ty1::iterator_concept
, std::input_iterator_tag
>);
28 using ty2
= std::move_iterator
<decltype(std::declval
<test_forward_range
<int>&>().begin())>;
29 static_assert(std::same_as
<ty2::iterator_concept
, std::forward_iterator_tag
>);
31 using ty3
= std::move_iterator
<decltype(std::declval
<test_bidirectional_range
<int>&>().begin())>;
32 static_assert(std::same_as
<ty3::iterator_concept
, std::bidirectional_iterator_tag
>);
34 using ty4
= std::move_iterator
<decltype(std::declval
<test_random_access_range
<int>&>().begin())>;
35 static_assert(std::same_as
<ty4::iterator_concept
, std::random_access_iterator_tag
>);
37 static_assert(std::random_access_iterator
<std::move_iterator
<int*>>);