https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83029
--- Comment #5 from Paul Pluzhnikov <ppluzhnikov at google dot com> --- (In reply to Jonathan Wakely from comment #4) > Which version of glibc are you using? "Debian GLIBC 2.24-12". I believe this bug should be closed as fixed or invalid: 1. The original test case does not fail on this system, and produces expected matching constructors / destructors: Constructing printer. Constructing printer. Printing something... Destroying printer... Printing something... Destroying printer... 2. The test case from #c2 is quite different (because thread_local is in function scope rather than the global scope), and is actually a (hard to spot) bug in the test case. Analysis by richardsm...@google.com: "The program references a function-static local variable without ever having executed its initializer." (This happens because function-local thread_local variables are initialized when they are reached, just like function-local static variables, and that never happens in the test case from #c2)