https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90215
Bug ID: 90215 Summary: ICE with lambda in fold expression over comma and assignment Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: vittorio.romeo at outlook dot com Target Milestone: --- The following code #include <tuple> template <class T> struct X { template <class F> void f(F f) { f(0); } }; template <class... Xs> void bug(X<Xs>... xs) { std::tuple<Xs...> t; std::apply([&](auto&... ys) { (xs.f([&](auto y) { ys = y; }), ...); }, t); } int main() { bug(X<int>{}); } produces an ICE with g++ trunk (version 9.0.1 20190422): <source>:22:16: internal compiler error: in tsubst_copy, at cp/pt.c:15551 22 | ys = y; | ~~~^~~ The bug can be reproduced on godbolt.org here: https://gcc.godbolt.org/z/NNLI5p