| 1 |
#include <coroutine> |
| 2 |
|
| 3 |
struct task { |
| 4 |
struct promise_type { |
| 5 |
std::suspend_always initial_suspend(); |
| 6 |
std::suspend_always final_suspend() noexcept; |
| 7 |
task get_return_object(); |
| 8 |
void return_void(); |
| 9 |
void unhandled_exception(); |
| 10 |
}; |
| 11 |
}; |
| 12 |
|
| 13 |
task |
| 14 |
my_coro () |
| 15 |
{ |
| 16 |
try |
| 17 |
{ } |
| 18 |
catch (...) |
| 19 |
{ |
| 20 |
// [expr.await] An await-expression shall appear only in a potentially- |
| 21 |
// evaluated expression within the compound-statement of a function-body |
| 22 |
// outside of a handler |
| 23 |
co_await std::suspend_always{}; // { dg-error "await expressions are not permitted in handlers" } |
| 24 |
} |
| 25 |
} |