| 1 |
// { dg-additional-options "-Wno-pedantic" } |
| 2 |
|
| 3 |
#if __has_include(<coroutine>) |
| 4 |
#include <coroutine> |
| 5 |
#elif __has_include(<experimental/coroutine>) |
| 6 |
#include <experimental/coroutine> |
| 7 |
namespace std { |
| 8 |
using namespace std::experimental; |
| 9 |
} |
| 10 |
#endif |
| 11 |
|
| 12 |
struct future { |
| 13 |
struct promise_type { |
| 14 |
void return_void() {} |
| 15 |
std::suspend_always initial_suspend() noexcept { return {}; } |
| 16 |
std::suspend_always final_suspend() noexcept { return {}; } |
| 17 |
void unhandled_exception() {} |
| 18 |
future get_return_object() { return {}; } |
| 19 |
}; |
| 20 |
bool await_ready() { return false; } |
| 21 |
void await_suspend(std::coroutine_handle<>) {} |
| 22 |
int await_resume() { return 42; } |
| 23 |
}; |
| 24 |
|
| 25 |
future failcase() { |
| 26 |
co_await ({auto x = future{}; x;}); |
| 27 |
} |