https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94879
Bug ID: 94879 Summary: coroutines: ICE building folly in captures_temporary, at cp/coroutines.cc:2707 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 48421 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48421&action=edit fix under test The following code should compile, but fails with Excess errors: /src-local/cxx-coroutines/gcc/testsuite/g++.dg/coroutines/folly-1.C:48:39: internal compiler error: in captures_temporary, at cp/coroutines.cc:2707 libbacktrace could not find executable to open The problem is that we are not properly accounting for proxy variable cases. ==== namespace std { template <typename a> a b(a &&); template <typename c> struct d { c e; }; template <typename f, typename> struct coroutine_traits : f {}; template <typename = void> struct coroutine_handle; template <> struct coroutine_handle<> {}; template <typename> struct coroutine_handle : coroutine_handle<> {}; struct g {}; } // namespace std class h {}; class i { i(i &&); }; namespace ac { template <typename> class ad { public: bool await_ready(); void await_resume(); void await_suspend(std::coroutine_handle<>); i ae; }; } // namespace ac template <typename ab> ac::ad<ab> operator co_await(ab); class j { class l {}; public: std::g initial_suspend(); l final_suspend(); }; class m : public j { public: void get_return_object(); void unhandled_exception(); }; class n { public: using promise_type = m; }; std::d<h> k; void a() { auto am = k; [&]() -> n { co_await std::b(am.e); }; }