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

            Bug ID: 117321
           Summary: std::float16_t: undefined reference to `nextafterf16'
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pkeir at outlook dot com
  Target Milestone: ---

#include <stdfloat>
#include <cmath>

int main(int argc, char *argv[])
{
  std::float16_t f0{0}, f1{1};
  std::nextafter(f0, f1);
  return 0;
}

Compiling the C++23 program above (`g++ -std=c++23 na16test.cpp`) produces a
linker error (listed below) indicating that the `nextafterf16` symbol is
undefined. The Compiler Explorer site can show this at
https://godbolt.org/z/Wz5cn5nbn.

ASM generation compiler returned: 0
/opt/compiler-explorer/gcc-trunk-20241027/bin/../lib/gcc/x86_64-linux-gnu/15.0.0/../../../../x86_64-linux-gnu/bin/ld:
/tmp/cc2bF2S8.o: in function `std::nextafter(_Float16, _Float16)':
/opt/compiler-explorer/gcc-trunk-20241027/include/c++/15.0.0/cmath:2884:(.text._ZSt9nextafterDF16_DF16_[_ZSt9nextafterDF16_DF16_]+0x33):
undefined reference to `nextafterf16'
collect2: error: ld returned 1 exit status
Execution build compiler returned: 1

Reply via email to