https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90647
--- Comment #1 from Eric Gallager <egallager at gcc dot gnu.org> --- (In reply to Antony Polukhin from comment #0) > Consider the example: > > auto test(int s) { > return [&s] { return s; }; > } > > > `s` is a local variable, so we return a lambda that has a dangling reference. > > It would be nice to have a warning for such cases. Under -Wreturn-local-addr, or a new flag?