Debian Codegraph @

gcc/testsuite/g++.dg/coroutines/pr111728.C

raw
1 // { dg-do compile }
2 // https://gcc.gnu.org/PR111728
3 #include <coroutine>
4 struct promise;
5 struct coroutine : std::coroutine_handle<promise>
6 {
7 using promise_type = ::promise;
8 bool await_ready() { return false; }
9 void await_suspend(coroutine_handle h) {}
10 int await_resume() { return {} ;}
11 };
12 struct promise
13 {
14 coroutine get_return_object() { return {coroutine::from_promise(*this)}; }
15 std::suspend_always initial_suspend() noexcept { return {}; }
16 std::suspend_always final_suspend() noexcept { return {}; }
17 void return_void() {}
18 void unhandled_exception() {}
19 };
20 coroutine
21 write_fields() {
22 int static_buffer[10];
23 co_await [](auto)
24 -> coroutine
25 {
26 if (sizeof(static_buffer));
27 co_return;
28 }(0);
29 }