Hi, I apologize for the chrum that this patch created. I have added this static assert to detect environments where __float128 is same as long double. >From original commit message: >We also provide formatter<__float128, _CharT> that formats via __flt128_t. >As this type may be disabled (-mno-float128), extra care needs to be taken, >for situation when __float128 is same as long double. If the formatter would be >defined in such case, the formatter<long double, _CharT> would be generated >from different specializations, and have different mangling: > * formatter<__float128, _CharT> if __float128 is present, > * formatter<__format::__formattable_float, _CharT> otherwise. >To best of my knowledge this happens only on ppc64 for __ieee128 and __float128, >so the formatter is not defined in this case. static_assert is added to detect >other configurations like that. In such case we should replace it with constra
I do not have access to a machine with that setup to confirm, but could you please check if the following patch fixes this. --- libstdc++-v3/include/std/format | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format index b1823db83bc..a870aa3f3ea 100644 --- a/libstdc++-v3/include/std/format +++ b/libstdc++-v3/include/std/format @@ -2979,6 +2979,7 @@ namespace __format // as __float128 when present is same type as __ieee128, which may be same as // long double. template<__format::__char _CharT> + requires (!is_same_v<__float128, long double>) struct formatter<__float128, _CharT> { formatter() = default; @@ -2995,9 +2996,6 @@ namespace __format private: __format::__formatter_fp<_CharT> _M_f; - - static_assert( !is_same_v<__float128, long double>, - "This specialization should not be used for long double" ); }; #endif -- 2.49.0 On Thu, May 15, 2025 at 7:46 PM Rainer Orth <r...@cebitec.uni-bielefeld.de> wrote: > Hi Jonathan, > > > On Thu, 15 May 2025 at 15:02, Rainer Orth <r...@cebitec.uni-bielefeld.de> > wrote: > >> > >> Hi Jonathan, > >> > >> >> > this patch broke Solaris bootstrap, both i386-pc-solaris2.11 and > >> >> > sparc-sun-solaris2.11: > >> >> > > >> >> > In file included from > >> >> > /vol/gcc/src/hg/master/local/libstdc++-v3/src/c++20/format.cc:29: > >> >> > > /var/gcc/regression/master/11.4-gcc/build/i386-pc-solaris2.11/libstdc++-v3/include/format: > >> >> > In member function ‘typename std::basic_format_context<_Out, > >> >> > _CharT>::iterator std::formatter<__float128, > >> >> > _CharT>::format(__float128, std::basic_format_context<_Out, > _CharT>&) > >> >> > const’: > >> >> > > /var/gcc/regression/master/11.4-gcc/build/i386-pc-solaris2.11/libstdc++-v3/include/format:2994:41: > >> >> > error: ‘__flt128_t’ is not a member of ‘std::__format’; did you > mean > >> >> > ‘__bflt16_t’? [-Wtemplate-body] > >> >> > 2994 | { return _M_f.format((__format::__flt128_t)__u, > __fc); } > >> >> > | ^~~~~~~~~~ > >> >> > | __bflt16_t > >> >> > > >> >> > and one more instance. > >> >> > >> >> And on x86_64-darwin too. > >> > > >> > Tomasz, should this be: > >> > > >> > --- a/libstdc++-v3/include/std/format > >> > +++ b/libstdc++-v3/include/std/format > >> > @@ -2973,7 +2973,7 @@ namespace __format > >> > }; > >> > #endif > >> > > >> > -#if defined(__SIZEOF_FLOAT128__) && _GLIBCXX_FORMAT_F128 != 1 > >> > +#if defined(__SIZEOF_FLOAT128__) && _GLIBCXX_FORMAT_F128 > 1 > >> > // Reuse __formatter_fp<C>::format<__format::__flt128_t, Out> for > __float128. > >> > // This formatter is not declared if > >> > _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT is true, > >> > // as __float128 when present is same type as __ieee128, which may > be same as > >> > > >> > >> with this patch applied, I could link libstdc++.so. I'll run a full > >> bootstrap later today. > > > > > > Good to know, thanks. Tomasz already pushed that change as > > r16-647-gd010a39b9e788a > > so trunk should be OK now. > > it is on Solaris/i386, but sparc is broken in a different way now: > > /var/gcc/regression/master/11.4-gcc/build/sparc-sun-solaris2.11/libstdc++-v3/include/format:2999:23: > error: static assertion failed: This specialization should not be used for > long double > 2999 | static_assert( !is_same_v<__float128, long double>, > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > /var/gcc/regression/master/11.4-gcc/build/sparc-sun-solaris2.11/libstdc++-v3/include/format:2999:23: > note: ‘!(bool)std::is_same_v<long double, long double>’ evaluates to false > /var/gcc/regression/master/11.4-gcc/build/sparc-sun-solaris2.11/libstdc++-v3/include/format: > In instantiation of ‘struct std::formatter<long double, char>’: > /var/gcc/regression/master/11.4-gcc/build/sparc-sun-solaris2.11/libstdc++-v3/include/type_traits:3559:54: > required from ‘constexpr const bool > std::is_default_constructible_v<std::formatter<long double, char> >’ > 3559 | inline constexpr bool is_default_constructible_v = > __is_constructible(_Tp); > | > ^~~~~~~~~~~~~~~~~~~~~~~ > [...] > > I've a local patch in tree to support __float128 on SPARC, so I'll try > with an unmodified tree first. However, 2 days ago I could bootstrap > with that included just fine. > > Rainer > > -- > > ----------------------------------------------------------------------------- > Rainer Orth, Center for Biotechnology, Bielefeld University > >