Debian Codegraph @

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

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