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 { get_return_objectdummy::promise_type13 dummy get_return_object() const noexcept { return {}; } get_return_object_on_allocation_failuredummy::promise_type14 static dummy get_return_object_on_allocation_failure() noexcept { return {}; } initial_suspenddummy::promise_type15 std::suspend_always initial_suspend() const noexcept { return {}; } final_suspenddummy::promise_type16 std::suspend_never final_suspend() const noexcept { return {}; } return_voiddummy::promise_type17 void return_void() const noexcept {} unhandled_exceptiondummy::promise_type18 void unhandled_exception() const noexcept {} 19 }; 20 }; 21 foo()22dummy foo() // { dg-error {dummy::promise_type::get_return_object_on_allocation_failure.*but 'std::nothrow' cannot be found} } 23 { 24 co_return; 25 } 26 27