| 1 |
// { dg-do compile { target c++17 } } |
| 2 |
|
| 3 |
#include "coro.h" |
| 4 |
|
| 5 |
// Test that we get matching types to traits and promise param |
| 6 |
// preview. |
| 7 |
|
| 8 |
// A separate issue from allowing non-class return types. |
| 9 |
struct Fake {} ; |
| 10 |
|
| 11 |
template<typename R, typename CallOp, typename ...T> |
| 12 |
struct std::coroutine_traits<R, CallOp, T...> { |
| 13 |
struct promise_type { |
| 14 |
promise_type (CallOp op, T ...args) {} |
| 15 |
Fake get_return_object() { return {}; } |
| 16 |
std::suspend_always initial_suspend() { return {}; } |
| 17 |
std::suspend_never final_suspend() noexcept { return {}; } |
| 18 |
void return_void() {} |
| 19 |
void unhandled_exception() {} |
| 20 |
}; |
| 21 |
}; |
| 22 |
|
| 23 |
|
| 24 |
struct Foo |
| 25 |
{ |
| 26 |
Fake operator() (int a) { |
| 27 |
co_return; |
| 28 |
} |
| 29 |
}; |