| 1 |
// https://gcc.gnu.org/PR112341 |
| 2 |
#include <coroutine> |
| 3 |
struct A { int j; }; |
| 4 |
struct B { |
| 5 |
bool await_ready(); |
| 6 |
bool await_suspend(std::coroutine_handle<>); |
| 7 |
A await_resume(); |
| 8 |
}; |
| 9 |
struct C { |
| 10 |
struct promise_type { |
| 11 |
std::suspend_always initial_suspend(); |
| 12 |
std::suspend_always final_suspend() noexcept; |
| 13 |
B yield_value(auto); |
| 14 |
void unhandled_exception(); |
| 15 |
C get_return_object(); |
| 16 |
void return_value(A); |
| 17 |
}; |
| 18 |
}; |
| 19 |
template<typename> |
| 20 |
C f() { |
| 21 |
// Make sure we verify types we can still. |
| 22 |
(co_await B()).i; // { dg-error "'struct A' has no member named 'i'" } |
| 23 |
(co_yield 123).i; // { dg-error "'struct A' has no member named 'i'" } |
| 24 |
co_return 123; // { dg-error "cannot convert 'int' to 'A'" } |
| 25 |
} |