https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101133
Bug ID: 101133 Summary: co_await doesn't accept a valid awaitable object if await_resume()'s return type is not a built-in type. Product: gcc Version: 11.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: liuyaoxin1976 at qq dot com Target Milestone: --- #include <coroutine> #include <string> template<typename T> struct Awaiter { bool await_ready() const { return false; } void await_suspend(std::coroutine_handle<>) const {} T await_resume() const { return T{}; } }; struct ReturnObject { struct promise_type { ReturnObject get_return_object() { return {}; } std::suspend_never initial_suspend() noexcept { return {}; } std::suspend_never final_suspend() noexcept { return {}; } void return_void() {} void unhandled_exception() {} }; }; ReturnObject f() { auto a1 = Awaiter<int>{}; auto a2 = Awaiter<std::string>{}; [[maybe_unused]] auto v1 = co_await a1; // ok [[maybe_unused]] auto v2 = co_await a2; // error } The error message is: no suspend point info for ''co_await' not supported by dump_decl<declaration error>' See also: https://godbolt.org/z/4xdYreb9f