https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100429
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to cqwrteur from comment #0) > It looks like libgcc DOES provide threading support for windows. However, > _GLIBCXX_HAS_GTHREADS does not get defined for libstdc++, I guess it is > another libtool issue. > > SO GOOD, if we fix them, we will have our own threading support for GCC on > windows. > > > https://github.com/gcc-mirror/gcc/blob/master/libgcc/config/i386/gthr-win32.h > > > _GLIBCXX_HAS_GTHREADS Just read the comments in libgcc/gthr.h If the following are also defined, you should #define __GTHREADS_CXX0X 1 to enable the c++0x thread library. None of the required functions are defined by gthr-win32.h so it (correctly) doesn't define __GTHREADS_CXX0X and so libstdc++ doesn't use it. > In file included from > d:\toolchains\include\c++\12.0.0\x86_64-w64-mingw32\bits\gthr.h:148, > from b.cc:4: > d:\toolchains\include\c++\12.0.0\x86_64-w64-mingw32\bits\gthr-default.h: In > function 'int __gthread_setspecific(__gthread_key_t, const void*)': > d:\toolchains\include\c++\12.0.0\x86_64-w64-mingw32\bits\gthr-default.h:629: > 27: error: types may not be defined in casts > 629 | if (TlsSetValue (__key, CONST_CAST2(void *, const void *, __ptr)) > != 0) > | ^~~~~~~~~~~ > > BTW. there is another bug in libgcc. This does not work. > > An alternative code should be if (TlsSetValue (__key, void*( __ptr)) != 0) This seems like an entirely separate issue.