https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104958
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- A C++ example with lamdbas which shows the same issue here (the IR is basically the same): int outer; auto fn1(int val = 0){ return [&]{ outer = val; // invalid }; }