https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102084
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Sergio Losilla from comment #4) > I see, thanks! The second version (constant_ref) which returns the reference > to the captured does not trigger the sanitizer, so returning a reference to > that is valid? In the second case you are returning a reference to the capatured lamdba struct.