https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95591
Bug ID: 95591 Summary: [coroutines] ICE when co_yielding string literal from generator coroutine Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: lewissbaker.opensource at gmail dot com Target Milestone: --- Build the following code sample using GCC trunk. Command-line flags: -std=c++2a -fcoroutines ---------- #include <coroutine> using namespace std; struct generator { struct promise_type { generator get_return_object(); void return_void(); void unhandled_exception(); suspend_always initial_suspend(); suspend_always final_suspend(); template<typename Arg> suspend_always yield_value(Arg&&) { return {}; } }; }; generator x() { co_yield "foo"; } ---------- Fails with following error: <source>: In function 'generator x()': <source>:23:1: internal compiler error: in captures_temporary, at cp/coroutines.cc:2773 23 | } | ^ See https://godbolt.org/z/UUbcKQ