| 1 | // PR libstdc++/116038 |
| 2 | // { dg-do compile { target c++20 } } |
| 3 | |
| 4 | #include <functional> |
| 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 apply_a(int, A); |
| 17 | int apply_b(int, B); |
| 18 | |
| 19 | int main() { |
| 20 | overloaded o = { std::bind_front(apply_a, 1), |
| 21 | std::bind_front(apply_b, 2) }; |
| 22 | A a; |
| 23 | o(a); |
| 24 | std::as_const(o)(a); |
| 25 | std::move(o)(a); |
| 26 | std::move(std::as_const(o))(a); |
| 27 | } |