Debian Codegraph @

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

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