Debian Codegraph @

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

raw
1 // https://gcc.gnu.org/PR105475
2 // Test the case where we create a non-static from_address.
3 #include <coroutine>
4
5 struct promise;
6
7 struct task
8 { using promise_type = promise; };
9
10 struct promise
11 {
12 void return_void () {}
13 std::suspend_never final_suspend() noexcept { return {}; }
14 std::suspend_never initial_suspend() noexcept { return {}; }
15 void unhandled_exception () {}
16 task get_return_object() { return {}; }
17 };
18
19 /* Invalid. */
20 namespace std
21 {
22 template<>
23 struct coroutine_handle<promise>
24 { coroutine_handle from_address(void*); };
25 };
26
27 task foo()
28 { co_return; }
29 // { dg-error "std::__n4861::coroutine_handle<promise>::from_address' must be a non-overloaded static function" "" { target *-*-* } {.-1} }