https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120495
Bug ID: 120495 Summary: error: non-template type 'coroutine_handle' used as a template Product: gcc Version: 15.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: lh_mouse at 126 dot com Target Milestone: --- This code fails to compile: (https://godbolt.org/z/jc3cnvacz) ``` #include <coroutine> #include <exception> struct fire_and_forget {}; template <typename... Args> struct std::coroutine_traits<fire_and_forget, Args...> { struct promise_type { fire_and_forget get_return_object() const noexcept { return{}; } void return_void() const noexcept { } suspend_never initial_suspend() const noexcept { return{}; } suspend_never final_suspend() const noexcept { return{}; } void unhandled_exception() const noexcept { std::terminate(); } }; }; struct foo { fire_and_forget bar() { co_await std::suspend_always{ }; } private: // comment out line below to fix error using coroutine_handle = std::coroutine_handle<>; }; int main() { foo{}.bar(); } ``` ``` <source>: In member function 'fire_and_forget foo::bar()': <source>:41:39: error: non-template type 'coroutine_handle' used as a template 41 | co_await std::suspend_always{ }; | ^ <source>:41:9: error: cannot instantiate a 'coroutine handle' for promise type 'void' 41 | co_await std::suspend_always{ }; | ^~~~~~~~ <source>:42:5: error: non-template type 'coroutine_handle' used as a template 42 | } | ^ <source>:39:21: error: cannot instantiate a 'coroutine handle' for promise type 'void' 39 | fire_and_forget bar() | ^~~ ``` Downstream reports: [1] https://github.com/msys2/MINGW-packages/issues/24209 [2] https://github.com/microsoft/cppwinrt/issues/1490