Debian Codegraph @

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

raw
1 // https://gcc.gnu.org/PR105475
2 // Test the case where we have type members instead of functions for
3 // from_address and address.
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>
12 struct coroutine_handle {
13 struct from_address {};
14 struct 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 "'std::coroutine_handle<void>::address' must be a non-overloaded method" "" { target *-*-* } {.-1} }