https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94759
Bug ID: 94759 Summary: coroutines: rejects traits specialisation with non-class returns. Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: iains at gcc dot gnu.org Target Milestone: --- Created attachment 48373 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48373&action=edit fix under test >From the standard: The header <coroutine> defines the primary template coroutine_traits such that if ArgTypes is a parameter pack of types and if the qualified-id R::promise_type is valid and denotes a type, then coroutine_traits<R,ArgTypes...> has the following publicly accessible member: using promise_type = typename R::promise_type; this should not prevent more specialised cases and the following code should be accepted, but is currently rejected with error: coroutine return type ‘void’ is not a class #include <coroutine> template<typename R, typename HandleRef, typename ...T> struct std::coroutine_traits<R, HandleRef, T...> { struct promise_type { promise_type (HandleRef h, T ...args) { h = std::coroutine_handle<promise_type>::from_promise (*this); PRINT ("Created Promise"); } void get_return_object() {} auto initial_suspend() { return std::suspend_always{}; } auto final_suspend() { return std::suspend_never{}; } void return_void() {} void unhandled_exception() {} }; }; void my_coro (std::coroutine_handle<>& h) { PRINT ("coro1: about to return"); co_return; }