https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120686
Bug ID: 120686 Summary: ICE on a lambda that uses parameter pack capture and parameter pack indexing in decltype return type Product: gcc Version: 15.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: e.siga at proton dot me Target Milestone: --- template<int I> struct constant {}; template<typename ...Args> auto fast_tuple(Args... args) { return [...args = args] <int I> (constant<I>) -> decltype(args...[I]) { return args...[I]; }; } int main() { auto r = fast_tuple(1, 2.0); auto &&ll = r(constant<0>{}); } ================================================== https://godbolt.org/z/Y44sT6qdr Unfortunately I couldn't minimize this code snippet more: * If you change the return type of the lambda (-> decltype(args...[I])), it stops crashing * If you remove constant<I> and start using non-deduced index, it stops crashing Somehow the synergy of these features causes the crash