// RUN: %clang_cc1 %s -std=c++20 -fsyntax-only -verify #include "Inputs/std-coroutine.h" struct MyTask{ struct promise_type { MyTask get_return_object(); std::suspend_always initial_suspend() { return {}; } void unhandled_exception(); void return_void(); auto final_suspend() noexcept { struct Awaiter { bool await_ready() noexcept { return false; } std::coroutine_handle await_suspend(std::coroutine_handle h) noexcept; void await_resume() noexcept; }; return Awaiter{}; } // The coroutine to resume when we're done. std::coroutine_handle resume_when_done; }; }; MyTask DoSomething() { static_assert(__is_same(void, decltype(co_await 0))); // expected-error {{'co_await' cannot be used in an unevaluated context}} co_return; } MyTask DoAnotherthing() { static_assert(__is_same(void, decltype(co_yield 0))); // expected-error {{'co_yield' cannot be used in an unevaluated context}} co_return; } template struct Task {}; void BracedInitListCXX26() { []() -> Task<{ co_await 1 }> {}; // expected-error {{'co_await' cannot be used in an unevaluated context}} []() -> Task<{ co_yield 1 }> {}; // expected-error {{'co_yield' cannot be used in an unevaluated context}} }