Previously discussed with zturner on IRC.
|59 ↗||(On Diff #23029)|
Can you change all these to:
static llvm::ManagedStatic<std::once_flag> g_once_flag; std::call_once(*g_once_flag, ...);
The reason for this is that Windows and MSVC don't yet have thread-safe initialization of function local statics that have a constructor. On most platforms, members of once_flag are linker initialized, but on Windows they have an actual constructor.
You can add a TODO line that indicates that once we require MSVC 2015 as the minimum version, we can remove these and use regular std::once_flags. Same comment applies to all the rest of the occurrences in the file as well.