gcc/testsuite/g++.dg/coroutines/pr113457-1.C
raw| 1 | // https://gcc.gnu.org/PR113457 |
| 2 | #include <coroutine> |
| 3 | |
| 4 | struct coro |
| 5 | { |
| 6 | struct promise_type |
| 7 | { |
| 8 | std::suspend_never initial_suspend (); |
| 9 | std::suspend_never final_suspend () noexcept; |
| 10 | void return_void (); |
| 11 | void unhandled_exception (); |
| 12 | coro get_return_object (); |
| 13 | }; |
| 14 | }; |
| 15 | |
| 16 | struct not_quite_suspend_never : std::suspend_never |
| 17 | {}; |
| 18 | |
| 19 | coro |
| 20 | foo () |
| 21 | { |
| 22 | co_await std::suspend_never{}, |
| 23 | [] () -> coro { co_return; }, |
| 24 | co_await not_quite_suspend_never{}; |
| 25 | } |