| 1 |
#if __has_include(<coroutine>) |
| 2 |
#include <coroutine> |
| 3 |
#else |
| 4 |
#include <experimental/coroutine> |
| 5 |
namespace std { using namespace experimental; } |
| 6 |
#endif |
| 7 |
|
| 8 |
struct dummy_coroutine {}; |
| 9 |
|
| 10 |
namespace std { |
| 11 |
|
| 12 |
template<> |
| 13 |
class coroutine_traits<::dummy_coroutine> { |
| 14 |
public: |
| 15 |
struct promise_type { |
| 16 |
void return_value(int x) { } |
| 17 |
void return_void() {} |
| 18 |
std::suspend_never initial_suspend() noexcept { return {}; } |
| 19 |
std::suspend_never final_suspend() noexcept { return {}; } |
| 20 |
dummy_coroutine get_return_object() { return {}; } |
| 21 |
void unhandled_exception() {} |
| 22 |
}; |
| 23 |
}; |
| 24 |
|
| 25 |
} |
| 26 |
|
| 27 |
dummy_coroutine |
| 28 |
foo() { // { dg-error {the coroutine promise type 'std::__n4861::coroutine_traits<dummy_coroutine>::promise_type' declares both 'return_value' and 'return_void'} } |
| 29 |
co_return 17; |
| 30 |
} |