https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81915
Arthur Norman <acn1 at cam dot ac.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |acn1 at cam dot ac.uk --- Comment #3 from Arthur Norman <acn1 at cam dot ac.uk> --- Created attachment 47280 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47280&action=edit test script to illustrate the linker problems with static inline thread_local and the Microsoft object format This is an issue with linking under Cygwin and so may be related to the object format used on Windows. My example behaves OK on bot x86_64 and ARM Linux (asn on a Mac) but fails under Cygwin and the mingw32 compilers used via cygwin. It looks like a failure to transcribe the "inline" (ir multiple definitions OK) attribute to the ¥thread-local initialization routine. The original bug report has a std::string and one might worry lest std::string was special or complicated. My one here just uses simple piain data. It is possible to achieve something that works on Windows because if I put the definitions of the static thread_local things inside an inline function rather than just within a class having several copies in separate compilation units does not cause link-time problems, so I find it hard to believe that this is an unsurmountable problem on Windows.