Due to C++'s "static initialization order fiasco", we should move the UMutex global statics to be function statics instead. This was done as an intermediate change from Andy in PR #522 but later reverted in PR #655.
The proposed change would be like the following on line 66 of locid.cpp:
The code that references these variables will also need to be updated.
There are 23 such occurrences in ICU that should be fixed.
This is only a real concern for Visual Studio versions below 2019, and maybe other compilers that cannot make UMutex constexpr. See umutex.h:
Note that the prebuilt binaries for Windows are built using VS2017.
From discussion in the ICU-TC call on 2020-04-15, its too late to put this into ICU 67.
The plan from the meeting:
Create a PR into the maint/maint-67 but don’t merge it. This provides a public patch that others could use/reference if they hit the issue and need a fix. Then on the download page for ICU, link to this ticket. For 68 and above, we should file a new ticket to try to move to VS2019, which doesn’t have this issue.
This was fixed in 68 by upgrading to VS 2019 in ICU-21108.