| 1 |
// PR libstdc++/120789 - ranges::remove_if should use ranges::iter_move |
| 2 |
// { dg-do compile { target c++20 } } |
| 3 |
|
| 4 |
#include <algorithm> |
| 5 |
|
| 6 |
struct A |
| 7 |
{ |
| 8 |
bool operator==(const A&) const; |
| 9 |
}; |
| 10 |
|
| 11 |
struct B |
| 12 |
{ |
| 13 |
B(B&&) = delete; |
| 14 |
B& operator=(const A&) const; |
| 15 |
|
| 16 |
operator A() const; |
| 17 |
bool operator==(const B&) const; |
| 18 |
}; |
| 19 |
|
| 20 |
struct I |
| 21 |
{ |
| 22 |
using value_type = A; |
| 23 |
using difference_type = int; |
| 24 |
B operator*() const; |
| 25 |
I& operator++(); |
| 26 |
I operator++(int); |
| 27 |
bool operator==(const I&) const; |
| 28 |
friend A iter_move(const I&); |
| 29 |
}; |
| 30 |
|
| 31 |
void |
| 32 |
test01() |
| 33 |
{ |
| 34 |
std::ranges::subrange<I, I> r; |
| 35 |
auto [begin, end] = std::ranges::remove_if(r, [](auto&&) { return true; }); |
| 36 |
} |