https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120976

            Bug ID: 120976
           Summary: error: static_assert( !is_same_v<__float128, long
                    double> failed
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: danglin at gcc dot gnu.org
                CC: tkaminsk at gcc dot gnu.org
  Target Milestone: ---
              Host: hppa64-hp-hpux11.11
            Target: hppa64-hp-hpux11.11
             Build: hppa64-hp-hpux11.11

libtool: compile:  /home/dave/gnu/gcc/objdir64/./gcc/xgcc -shared-libgcc
-B/home/dave/gnu/gcc/objdir64/./gcc -nostdinc++
-L/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/src
-L/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/src/.libs
-L/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/libsupc++/.libs
-B/opt/gnu64/gcc/gcc-16/hppa64-hp-hpux11.11/bin/
-B/opt/gnu64/gcc/gcc-16/hppa64-hp-hpux11.11/lib/ -isystem
/opt/gnu64/gcc/gcc-16/hppa64-hp-hpux11.11/include -isystem
/opt/gnu64/gcc/gcc-16/hppa64-hp-hpux11.11/sys-include -fno-checking
-I/home/dave/gnu/gcc/gcc/libstdc++-v3/../libgcc
-I/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/hppa64-hp-hpux11.11
-I/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include
-I/home/dave/gnu/gcc/gcc/libstdc++-v3/libsupc++ -std=gnu++20 -D_GLIBCXX_SHARED
-fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=19
-fdiagnostics-show-location=once -ffunction-sections -fdata-sections
-frandom-seed=tzdb.lo -fimplicit-templates -O2 -g -I. -c
../../../../../gcc/libstdc++-v3/src/c++20/tzdb.cc  -DPIC -D_GLIBCXX_SHARED -o
tzdb.o
In file included from
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/type_traits:40,
                 from
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/ratio:41,
                 from
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/bits/chrono.h:39,
                 from
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/chrono:45,
                 from ../../../../../gcc/libstdc++-v3/src/c++20/tzdb.cc:31:
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/bits/semaphore_base.h:
In constructor
'std::__atomic_semaphore::__atomic_semaphore(std::__detail::__platform_wait_t)':
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/bits/semaphore_base.h:178:32:
warning: comparison of unsigned expression in '>= 0' is always true
[-Wtype-limits]
  178 |       __glibcxx_assert(__count >= 0 && __count <= _S_max);
      |                        ~~~~~~~~^~~~
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/hppa64-hp-hpux11.11/bits/c++config.h:657:49:
note: in definition of macro '__glibcxx_assert'
  657 |     if (std::__is_constant_evaluated() && !bool(cond))                 
\
      |                                                 ^~~~
../../../../../gcc/libstdc++-v3/src/c++20/tzdb.cc: At global scope:
../../../../../gcc/libstdc++-v3/src/c++20/tzdb.cc:195:52: warning:
'init_priority' attribute ignored [-Wattributes]
  195 |   constinit tzdb_list tzdb_list::_Node::_S_the_list(nullptr);
      |                                                    ^
../../../../../gcc/libstdc++-v3/src/c++20/tzdb.cc:198:58: warning:
'init_priority' attribute ignored [-Wattributes]
  198 |   constinit tzdb_list::_Node::head_ptr
tzdb_list::_Node::_S_head_owner{nullptr};
      |                                                          ^~~~~~~~~~~~~
In file included from
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/bits/chrono_io.h:41,
                 from
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/chrono:3378:
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/format: In
instantiation of 'struct std::formatter<long double, wchar_t>':
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/type_traits:3559:54:
  required from 'constexpr const bool
std::is_default_constructible_v<std::formatter<long double, wchar_t> >'
 3559 |   inline constexpr bool is_default_constructible_v =
__is_constructible(_Tp);
      |                                                     
^~~~~~~~~~~~~~~~~~~~~~~
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/format:4942:23:
  required from
'std::__format::_Formatting_scanner<std::__format::_Sink_iter<wchar_t>,
wchar_t>::_M_format_arg(std::size_t)::<lambda(auto:9&)> [with auto:9 = long
double]'
 4942 |           else if constexpr (is_default_constructible_v<_Formatter>)
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/format:4360:44:
  required from 'decltype(auto)
std::basic_format_arg<_Context>::_M_visit(_Visitor&&, std::__format::_Arg_t)
[with _Visitor =
std::__format::_Formatting_scanner<std::__format::_Sink_iter<wchar_t>,
wchar_t>::_M_format_arg(std::size_t)::<lambda(auto:9&)>; _Context =
std::basic_format_context<std::__format::_Sink_iter<wchar_t>, wchar_t>]'
 4360 |               return std::forward<_Visitor>(__vis)(_M_val._M_ldbl);
      |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/format:4448:28:
  required from 'decltype(auto) std::__format::__visit_format_arg(_Visitor&&,
std::basic_format_arg<_Ctx>) [with _Visitor =
_Formatting_scanner<_Sink_iter<wchar_t>,
wchar_t>::_M_format_arg(std::size_t)::<lambda(auto:9&)>; _Ctx =
std::basic_format_context<_Sink_iter<wchar_t>, wchar_t>]'
 4448 |       return __arg._M_visit(std::forward<_Visitor>(__vis),
__arg._M_type);
      |             
~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/format:4935:30:
  required from 'constexpr void std::__format::_Formatting_scanner<_Out,
_CharT>::_M_format_arg(std::size_t) [with _Out =
std::__format::_Sink_iter<wchar_t>; _CharT = wchar_t; std::size_t = long
unsigned int]'
 4935 |         __format::__visit_format_arg([this](auto& __arg) {
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
 4936 |           using _Type = remove_reference_t<decltype(__arg)>;
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4937 |           using _Formatter = typename _Context::template
formatter_type<_Type>;
      |          
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4938 |           if constexpr (is_same_v<_Type, monostate>)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4939 |             __format::__invalid_arg_id_in_format_string();
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4940 |           else if constexpr (is_same_v<_Type, handle>)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4941 |             __arg.format(this->_M_pc, this->_M_fc);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4942 |           else if constexpr (is_default_constructible_v<_Formatter>)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4943 |             {
      |             ~                        
 4944 |               _Formatter __f;
      |               ~~~~~~~~~~~~~~~        
 4945 |               this->_M_pc.advance_to(__f.parse(this->_M_pc));
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4946 |               this->_M_fc.advance_to(__f.format(__arg, this->_M_fc));
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4947 |             }
      |             ~                        
 4948 |           else
      |           ~~~~                       
 4949 |             static_assert(__format::__formattable_with<_Type,
_Context>);
      |            
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4950 |         }, _M_fc.arg(__id));
      |         ~~~~~~~~~~~~~~~~~~~          
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/format:4930:7:
  required from here
 4930 |       _M_format_arg(size_t __id) override
      |       ^~~~~~~~~~~~~
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.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>,
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/format:2999:23:
note: '!(bool)std::is_same_v<long double, long double>' evaluates to false
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/format: In
instantiation of 'struct std::formatter<long double, char>':
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.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);
      |                                                     
^~~~~~~~~~~~~~~~~~~~~~~
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/format:4942:23:
  required from
'std::__format::_Formatting_scanner<std::__format::_Sink_iter<char>,
char>::_M_format_arg(std::size_t)::<lambda(auto:9&)> [with auto:9 = long
double]'
 4942 |           else if constexpr (is_default_constructible_v<_Formatter>)
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/format:4360:44:
  required from 'decltype(auto)
std::basic_format_arg<_Context>::_M_visit(_Visitor&&, std::__format::_Arg_t)
[with _Visitor =
std::__format::_Formatting_scanner<std::__format::_Sink_iter<char>,
char>::_M_format_arg(std::size_t)::<lambda(auto:9&)>; _Context =
std::basic_format_context<std::__format::_Sink_iter<char>, char>]'
 4360 |               return std::forward<_Visitor>(__vis)(_M_val._M_ldbl);
      |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/format:4448:28:
  required from 'decltype(auto) std::__format::__visit_format_arg(_Visitor&&,
std::basic_format_arg<_Ctx>) [with _Visitor =
_Formatting_scanner<_Sink_iter<char>,
char>::_M_format_arg(std::size_t)::<lambda(auto:9&)>; _Ctx =
std::basic_format_context<_Sink_iter<char>, char>]'
 4448 |       return __arg._M_visit(std::forward<_Visitor>(__vis),
__arg._M_type);
      |             
~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/format:4935:30:
  required from 'constexpr void std::__format::_Formatting_scanner<_Out,
_CharT>::_M_format_arg(std::size_t) [with _Out =
std::__format::_Sink_iter<char>; _CharT = char; std::size_t = long unsigned
int]'
 4935 |         __format::__visit_format_arg([this](auto& __arg) {
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
 4936 |           using _Type = remove_reference_t<decltype(__arg)>;
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4937 |           using _Formatter = typename _Context::template
formatter_type<_Type>;
      |          
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4938 |           if constexpr (is_same_v<_Type, monostate>)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4939 |             __format::__invalid_arg_id_in_format_string();
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4940 |           else if constexpr (is_same_v<_Type, handle>)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4941 |             __arg.format(this->_M_pc, this->_M_fc);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4942 |           else if constexpr (is_default_constructible_v<_Formatter>)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4943 |             {
      |             ~                        
 4944 |               _Formatter __f;
      |               ~~~~~~~~~~~~~~~        
 4945 |               this->_M_pc.advance_to(__f.parse(this->_M_pc));
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4946 |               this->_M_fc.advance_to(__f.format(__arg, this->_M_fc));
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4947 |             }
      |             ~                        
 4948 |           else
      |           ~~~~                       
 4949 |             static_assert(__format::__formattable_with<_Type,
_Context>);
      |            
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4950 |         }, _M_fc.arg(__id));
      |         ~~~~~~~~~~~~~~~~~~~          
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/format:4930:7:
  required from here
 4930 |       _M_format_arg(size_t __id) override
      |       ^~~~~~~~~~~~~
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.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>,
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/format:2999:23:
note: '!(bool)std::is_same_v<long double, long double>' evaluates to false
make[6]: *** [Makefile:754: tzdb.lo] Error 1

This error was introduced by commit 9c9a7316adb99693e237164908893a78b86ba000
(HEAD)
Author: Tomasz Kami<C5><84>ski <tkami...@redhat.com>
Date:   Wed Apr 30 10:37:48 2025 +0200

    libstdc++: Preserve the argument type in basic_format_args [PR119246]

It wasn't fixed by this commit:

commit d010a39b9e788a1b3c58e0954c1b2c6afad8210a
Author: Tomasz KamiƄski <tkami...@redhat.com>
Date:   Thu May 15 08:58:09 2025 +0200

    libstdc++: Fix preprocessor check for __float128 formatter [PR119246]

    The previous check `_GLIBCXX_FORMAT_F128 != 1` was passing if
    _GLIBCXX_FORMAT_F128 was not defined, i.e. evaluted to zero.

    This broke sparc-sun-solaris2.11 and x86_64-darwin.

            PR libstdc++/119246

    libstdc++-v3/ChangeLog:

            * include/std/format: Updated check for _GLIBCXX_FORMAT_F128.

This breaks build.

Reply via email to