| 1 | // { dg-do compile { target c++20 } } |
| 2 | |
| 3 | #include <algorithm> |
| 4 | #include <span> |
| 5 | |
| 6 | constexpr bool |
| 7 | test01() |
| 8 | { |
| 9 | // PR libstdc++/102358 |
| 10 | int x[2] = {1,2}, y[2]; |
| 11 | std::span in(x), out(y); |
| 12 | std::move(std::move_iterator(in.begin()), std::move_iterator(in.end()), |
| 13 | out.begin()); |
| 14 | return std::equal(std::move_iterator(in.begin()), std::move_iterator(in.end()), |
| 15 | std::move_iterator(out.begin())); |
| 16 | } |
| 17 | |
| 18 | static_assert(test01()); |
| 19 | |
| 20 | constexpr bool |
| 21 | test02() |
| 22 | { |
| 23 | int x[2] = {1,2}, y[2]; |
| 24 | std::span in(x), out(y); |
| 25 | std::move(in.rbegin(), in.rend(), out.rbegin()); |
| 26 | return std::equal(in.rbegin(), in.rend(), out.rbegin()); |
| 27 | } |
| 28 | |
| 29 | static_assert(test02()); |