Debian Codegraph @

gcc/testsuite/g++.dg/coroutines/pr105475-1.C

raw
1 // https://gcc.gnu.org/PR105475
2 // Test the case where we have everything we need for coroutine_handle<void>,
3 // but not for coroutine_handle<promise>.
4 namespace std {
5 struct awaitable {
6 bool await_ready() noexcept { return false; }
7 void await_suspend(auto) noexcept {}
8 bool await_resume() noexcept { return true; }
9 };
10
11 template <typename T> struct coroutine_handle {
12 static coroutine_handle from_address(void *address);
13 };
14
15 template <typename T = void> struct coroutine_traits {
16 struct promise_type {
17 awaitable initial_suspend() { return {}; }
18 awaitable final_suspend() noexcept { return {}; }
19 void return_void() {}
20 T get_return_object() { return T(); }
21 void unhandled_exception() {}
22 };
23 };
24 } // namespace std
25
26 void foo() { co_return; }
27 // { dg-error "'address' is not a member of 'std::coroutine_handle<void>'" "" { target *-*-* } {.-1} }