This is a follow-up for D5540. Despite the tests passing, the diff is
causing bitcoin-qt to fail quickly. Disabling thread_local for this
compiler fixes the issue.
The code is extracted from [[https://github.com/bitcoin/bitcoin/pull/15849 | PR15849]], but the tests for thread_local is a
simplified version.