https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110016
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- When you say you compiled with clang, did you use libstdc++ or libc++? Did you try adding gnu::always_inline attribute on the lambda to see if it fails there too? Again the inlining should not have an effect here except if there is some kind of race condition happening.