| 1 |
// PR libstdc++/116038 |
| 2 |
// { dg-do compile { target c++20 } } |
| 3 |
|
| 4 |
#include <ranges> |
| 5 |
#include <utility> |
| 6 |
|
| 7 |
struct A { }; |
| 8 |
struct B { }; |
| 9 |
|
| 10 |
template<class... Ts> |
| 11 |
struct overloaded : private Ts... { |
| 12 |
overloaded(Ts...); |
| 13 |
using Ts::operator()...; |
| 14 |
}; |
| 15 |
|
| 16 |
int x[5]; |
| 17 |
struct integralish { operator int() const; } i; |
| 18 |
|
| 19 |
int main() { |
| 20 |
overloaded o1 = { std::views::drop(i) }; |
| 21 |
o1(x); |
| 22 |
std::move(o1)(x); |
| 23 |
std::as_const(o1)(x); |
| 24 |
|
| 25 |
overloaded o2 = { std::views::drop(i) | std::views::take(i) }; |
| 26 |
o2(x); |
| 27 |
std::move(o2)(x); |
| 28 |
std::as_const(o1)(x); |
| 29 |
} |