| 1 |
// https://gcc.gnu.org/PR105475 |
| 2 |
// Test the case where we specialize coroutine_handle and break it. |
| 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 |
{}; |
| 25 |
}; |
| 26 |
|
| 27 |
task foo() |
| 28 |
{ co_return; } |
| 29 |
// { dg-error "'from_address' is not a member of 'std::__n4861::coroutine_handle<promise>'" "" { target *-*-* } {.-1} } |