https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67436
--- Comment #3 from Johannes S. Mueller-Roemer <j.s.mueller-roemer at gmx dot net> --- The following workaround seems to work as well: int main(int, char**) { thread_local int foo; [&foo=foo] (auto bar) { foo += bar; }(1u); return 0; }