https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86610
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- Smaller testcase from PR 87584 struct C { int operator[](int) { return 0; } int operator[](int) const { return 1; } }; template <typename T> int f(T) { C c; return [=] { return c[0]; }(); } int main() { return f(0); }