diff --git a/libstdc++-v3/testsuite/25_algorithms/move/105609.cc b/libstdc++-v3/testsuite/25_algorithms/move/105609.cc new file mode 100644 index 000000000000..810451987c9e --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/move/105609.cc @@ -0,0 +1,33 @@ +// { dg-do compile { target c++20 } } + +// PR libstdc++/105609 +// ranges::move should use ranges::iter_move instead of std::move + +#include + +namespace pr105609 +{ + struct I { + using value_type = int; + using difference_type = std::ptrdiff_t; + int operator*() const; + I& operator++(); + I operator++(int); + I& operator--(); + I operator--(int); + bool operator==(I) const; + friend int& iter_move(const I&); + }; +} + +void +test(pr105609::I i) +{ + struct O { + O(int&) { } + O(int&&) = delete; + }; + + O* o = nullptr; + std::ranges::move(i, i, o); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/move/constrained.cc b/libstdc++-v3/testsuite/25_algorithms/move/constrained.cc index e2b45b070ef2..587b2f3728b1 100644 --- a/libstdc++-v3/testsuite/25_algorithms/move/constrained.cc +++ b/libstdc++-v3/testsuite/25_algorithms/move/constrained.cc @@ -204,35 +204,6 @@ test05() VERIFY( ranges::equal(v, (int[]){1,2,3,0}) ); } -namespace pr105609 -{ - struct I { - using value_type = int; - using difference_type = std::ptrdiff_t; - int operator*() const; - I& operator++(); - I operator++(int); - I& operator--(); - I operator--(int); - bool operator==(I) const; - friend int& iter_move(const I&); - }; -} - -void -test06(pr105609::I i) -{ - // PR libstdc++/105609 - // ranges::move should use ranges::iter_move instead of std::move - struct O { - O(int&) { } - O(int&&) = delete; - }; - - O* o = nullptr; - std::ranges::move(i, i, o); -} - int main() { diff --git a/libstdc++-v3/testsuite/25_algorithms/move_backward/105609.cc b/libstdc++-v3/testsuite/25_algorithms/move_backward/105609.cc new file mode 100644 index 000000000000..a4fb8d846bda --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/move_backward/105609.cc @@ -0,0 +1,33 @@ +// { dg-do compile { target c++20 } } + +// PR libstdc++/105609 +// ranges::move should use ranges::iter_move instead of std::move + +#include + +namespace pr105609 +{ + struct I { + using value_type = int; + using difference_type = std::ptrdiff_t; + int operator*() const; + I& operator++(); + I operator++(int); + I& operator--(); + I operator--(int); + bool operator==(I) const; + friend int& iter_move(const I&); + }; +} + +void +test(pr105609::I i) +{ + struct O { + O(int&) { } + O(int&&) = delete; + }; + + O* o = nullptr; + std::ranges::move_backward(i, i, o); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/move_backward/constrained.cc b/libstdc++-v3/testsuite/25_algorithms/move_backward/constrained.cc index 4d94d386dd0b..8f6fd455b4b6 100644 --- a/libstdc++-v3/testsuite/25_algorithms/move_backward/constrained.cc +++ b/libstdc++-v3/testsuite/25_algorithms/move_backward/constrained.cc @@ -160,35 +160,6 @@ test03() return ok; } -namespace pr105609 -{ - struct I { - using value_type = int; - using difference_type = std::ptrdiff_t; - int operator*() const; - I& operator++(); - I operator++(int); - I& operator--(); - I operator--(int); - bool operator==(I) const; - friend int& iter_move(const I&); - }; -} - -void -test04(pr105609::I i) -{ - // PR libstdc++/105609 - // ranges::move should use ranges::iter_move instead of std::move - struct O { - O(int&) { } - O(int&&) = delete; - }; - - O* o = nullptr; - std::ranges::move_backward(i, i, o); -} - int main() {