http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60702
--- Comment #3 from Stan Pavlovski <dv.main at gmail dot com> --- Template class' thread_local member is not initialized unless other non-template class' thread_local member is initialized first: #include <iostream> using namespace std; struct far { struct boo { boo () { cerr << "far::boo" << endl; } int i = 42; }; static void baz() { cerr << far::FOO.i << endl; } static thread_local boo FOO; }; template<class T> struct bar { struct foo { foo () { cerr << "bar::foo" << endl; } int i = 42; }; void baz() { cerr << bar::FOO.i << endl; } static thread_local foo FOO; }; template<class T> thread_local typename bar<T>::foo bar<T>::FOO; thread_local typename far::boo far::FOO; int main() { bar<int> b; b.baz(); far f; f.baz(); return 0; } Output: 0 far::boo bar::foo 42