| 1 |
// { dg-additional-options "-g" } |
| 2 |
|
| 3 |
#include <coroutine> |
| 4 |
|
| 5 |
struct task { |
| 6 |
struct promise_type { |
| 7 |
task get_return_object() { return {}; } |
| 8 |
std::suspend_never initial_suspend() { return {}; } |
| 9 |
std::suspend_never final_suspend() noexcept { return {}; } |
| 10 |
void unhandled_exception() {} |
| 11 |
}; |
| 12 |
bool await_ready() { return false; } |
| 13 |
void await_suspend(std::coroutine_handle<> h) {} |
| 14 |
void await_resume() {} |
| 15 |
}; |
| 16 |
|
| 17 |
template <typename Func> |
| 18 |
void call(Func func) { func(); } |
| 19 |
|
| 20 |
class foo { |
| 21 |
void f(); |
| 22 |
task g(); |
| 23 |
}; |
| 24 |
|
| 25 |
void foo::f() { |
| 26 |
auto lambda = [this]() noexcept -> task { |
| 27 |
co_await g(); |
| 28 |
}; |
| 29 |
(void)call<decltype(lambda)>; |
| 30 |
} |
| 31 |
|
| 32 |
int main() {} |