https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106086
Bug ID: 106086 Summary: ICE: trying to capture 'this' in instantiation of generic lambda Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ldalessandro at gmail dot com Target Milestone: --- Following code generates ICE #include <array> #include <concepts> #include <utility> template <int> struct foo { constexpr auto operator()(std::same_as<int> auto...) const -> int { return 0; } }; template <int _size> struct bar : foo<_size> { constexpr auto operator()(std::array<int, _size> index) const -> int { return [&]<std::size_t... i>(std::index_sequence<i...>) { return foo<_size>::operator()(index[i]...); }(std::make_index_sequence<_size>()); } }; bar<1> b; int i = b({0}); // <-- ERROR <source>:18:58: internal compiler error: trying to capture 'this' in instantiation of generic lambda live: https://godbolt.org/z/TKGWME5aG A couple of similar, closed bugs show up in the search so I've added them as see-also. 105788 might be the same but it's listed as "ice-on-invalid-code" and I'm fairly sure mine is valid (it refers to 100291).