Index: libcxx/trunk/src/support/win32/thread_win32.cpp =================================================================== --- libcxx/trunk/src/support/win32/thread_win32.cpp +++ libcxx/trunk/src/support/win32/thread_win32.cpp @@ -254,9 +254,10 @@ int __libcpp_tls_create(__libcpp_tls_key* __key, void(_LIBCPP_TLS_DESTRUCTOR_CC* __at_exit)(void*)) { - *__key = FlsAlloc(__at_exit); - if (*__key == FLS_OUT_OF_INDEXES) + DWORD index = FlsAlloc(__at_exit); + if (index == FLS_OUT_OF_INDEXES) return GetLastError(); + *__key = index; return 0; }