https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66146
--- Comment #40 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Libor Bukata from comment #39) > (In reply to Libor Bukata from comment #38) > > (In reply to Jonathan Wakely from comment #34) > > > Untested sketch of a solution for Solaris and BSDs: > > > https://gcc.gnu.org/pipermail/gcc-patches/2020-November/557928.html > > > > Thank you for the patch, I will test it on Solaris > > and let you know when I have the results. > > Patched GCC master with Jonathan's patch, but unfortunately it is not > compilable on Solaris 11: > In file included from > /gcc_nightly/build/sparcv9/sparcv9-sun-solaris2.11/libstdc++-v3/include/ > sparcv9-sun-solaris2.11/bits/c++config.h:568, > from > /gcc_nightly/build/sparcv9/sparcv9-sun-solaris2.11/libstdc++-v3/include/ > cassert:43, > from > /gcc_nightly/gcc-11.0.0-master/libstdc++-v3/include/precompiled/stdc++.h:33: > /gcc_nightly/build/sparcv9/sparcv9-sun-solaris2.11/libstdc++-v3/include/ > mutex:861:10: error: token "{" is not valid in preprocessor expressions > 861 | || _GLIBCXX_COMPAT_PTHREAD_ONCE_T > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > In file included from > /gcc_nightly/build/sparcv9/sparcv9-sun-solaris2.11/libstdc++-v3/include/ > sparcv9-sun-solaris2.11/bits/c++config.h:568, > from > /gcc_nightly/build/sparcv9/sparcv9-sun-solaris2.11/libstdc++-v3/include/ > cassert:43, > from > /gcc_nightly/gcc-11.0.0-master/libstdc++-v3/include/precompiled/stdc++.h:33: > /gcc_nightly/build/sparcv9/sparcv9-sun-solaris2.11/libstdc++-v3/include/ > mutex:861:10: error: token "{" is not valid in preprocessor expressions > 861 | || _GLIBCXX_COMPAT_PTHREAD_ONCE_T > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Oops, that should be: || defined _GLIBCXX_COMPAT_PTHREAD_ONCE_T to test if the macro is defined, rather than testing its value. > In file included from > /gcc_nightly/build/sparcv9/sparcv9-sun-solaris2.11/libstdc++-v3/include/ > future:38, > from > /gcc_nightly/gcc-11.0.0-master/libstdc++-v3/include/precompiled/stdc++.h:105: > /gcc_nightly/build/sparcv9/sparcv9-sun-solaris2.11/libstdc++-v3/include/ > mutex:675:15: error: explicitly defaulted function 'constexpr > std::once_flag::once_flag()' cannot be declared 'constexpr' because the > implicit declaration is not 'constexpr': > 675 | constexpr once_flag() noexcept = default; > | ^~~~~~~~~ > /gcc_nightly/build/sparcv9/sparcv9-sun-solaris2.11/libstdc++-v3/include/ > mutex:699:12: note: defaulted constructor calls non-'constexpr' > 'std::once_flag::_Once::_Once()' > 699 | struct _Once _GLIBCXX_COMPAT_PTHREAD_ONCE_T; This one's a bit trickier. The struct needs a default constructor that initializes all its members, but then it can't be used in the union. I'll provide a new patch when I get a chance to look into it.