| 1 |
// { dg-additional-options "-std=c++17 -w" } |
| 2 |
|
| 3 |
#include "coro.h" |
| 4 |
|
| 5 |
class mycoro { |
| 6 |
public: |
| 7 |
class promise_type { |
| 8 |
public: |
| 9 |
std::suspend_always initial_suspend() const noexcept { return {}; } |
| 10 |
std::suspend_always final_suspend() const noexcept { return {}; } |
| 11 |
void unhandled_exception() noexcept { } |
| 12 |
mycoro get_return_object() { return mycoro{}; } |
| 13 |
}; |
| 14 |
}; |
| 15 |
|
| 16 |
class await { |
| 17 |
public: |
| 18 |
bool await_ready() const noexcept { return false; } |
| 19 |
bool await_suspend(std::coroutine_handle<>) noexcept {return true;} |
| 20 |
mycoro await_resume() { return mycoro{}; } |
| 21 |
}; |
| 22 |
|
| 23 |
mycoro foo(mycoro source) { (void) co_await await{}; } |