Debian Codegraph @

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

raw
1 // https://gcc.gnu.org/PR105475
2 // Test the case where we create a static address.
3 struct promise;
4
5 namespace std
6 {
7 template<typename>
8 struct coroutine_handle
9 {
10 static coroutine_handle from_address(void*);
11
12 static void* address();
13 };
14
15 struct suspend_never
16 {
17 bool await_ready();
18 void await_suspend(coroutine_handle<void>);
19 void await_resume();
20 };
21
22 template<typename T>
23 struct coroutine_traits
24 { using promise_type = typename T::promise_type; };
25 };
26
27
28 struct task
29 { using promise_type = promise; };
30
31 struct promise
32 {
33 void return_void () {}
34 std::suspend_never final_suspend() noexcept { return {}; }
35 std::suspend_never initial_suspend() noexcept { return {}; }
36 void unhandled_exception () {}
37 task get_return_object() { return {}; }
38 };
39
40 task foo() { co_return; }
41 // { dg-error "std::coroutine_handle<void>::address' must be a non-overloaded method" "" { target *-*-* } {.-1} }