| 1 |
// PR libstdc++/111327 - std::bind_front (and std::not_fn) doesn't always |
| 2 |
// perfectly forward according to value category of the call wrapper object |
| 3 |
// { dg-do compile { target c++17 } } |
| 4 |
|
| 5 |
#include <functional> |
| 6 |
#include <utility> |
| 7 |
|
| 8 |
struct F { |
| 9 |
void operator()(...) & = delete; |
| 10 |
bool operator()(...) const &; |
| 11 |
}; |
| 12 |
|
| 13 |
struct G { |
| 14 |
void operator()(...) && = delete; |
| 15 |
bool operator()(...) const &&; |
| 16 |
}; |
| 17 |
|
| 18 |
int main() { |
| 19 |
auto f = std::not_fn(F{}); |
| 20 |
f(); // { dg-error "deleted" } |
| 21 |
std::move(f)(); |
| 22 |
std::as_const(f)(); |
| 23 |
std::move(std::as_const(f))(); |
| 24 |
|
| 25 |
auto g = std::not_fn(G{}); |
| 26 |
g(); // { dg-error "deleted" } |
| 27 |
std::move(g)(); // { dg-error "deleted" } |
| 28 |
std::move(std::as_const(g))(); |
| 29 |
} |