| 1 |
#if __has_include (<coroutine>) |
| 2 |
#include <coroutine> |
| 3 |
using namespace std; |
| 4 |
#elif defined (__clang__) && __has_include (<experimental/coroutine>) |
| 5 |
#include <experimental/coroutine> |
| 6 |
namespace std { using namespace experimental; } |
| 7 |
#endif |
| 8 |
|
| 9 |
struct dummy |
| 10 |
{ |
| 11 |
struct promise_type |
| 12 |
{ |
| 13 |
dummy get_return_object() const noexcept { return {}; } |
| 14 |
static dummy get_return_object_on_allocation_failure() noexcept { return {}; } |
| 15 |
std::suspend_always initial_suspend() const noexcept { return {}; } |
| 16 |
std::suspend_never final_suspend() const noexcept { return {}; } |
| 17 |
void return_void() const noexcept {} |
| 18 |
void unhandled_exception() const noexcept {} |
| 19 |
}; |
| 20 |
}; |
| 21 |
|
| 22 |
dummy foo() // { dg-error {dummy::promise_type::get_return_object_on_allocation_failure.*but 'std::nothrow' cannot be found} } |
| 23 |
{ |
| 24 |
co_return; |
| 25 |
} |
| 26 |
|