Last week, I did:
> This patch fixes it.
> 
> 
> 2026-01-27  Bruno Haible  <[email protected]>
> 
>       isfinite-no-c++: Make more C++ safe.
>       * lib/math.in.h (isfinite): In C++ mode, define as a template with three
>       instantiations, instead of as a macro.

Well, it did not fix it on FreeBSD 14. There, the CI still reports a
compilation error:

  ../gllib/math.h:3031:36: error: call to 'isfinite' is ambiguous
  _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isfinite)
                                     ^~~~~~~~
  ../gllib/math.h:638:10: note: expanded from macro 
'_GL_MATH_CXX_REAL_FLOATING_DECL_1'
    return func (f);                                                  \
           ^~~~
  /usr/include/c++/v1/math.h:403:80: note: candidate function [with _A1 = 
float, $1 = 0]
  _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI 
bool isfinite(_A1 __x) _NOEXCEPT {
                                                                                
 ^
  ../gllib/math.h:3018:24: note: candidate function [with T = float]
  template <> inline int isfinite<float> (float x) { return gl_isfinitef (x); }
                         ^

This patch now fixes it, by ensuring REPLACE_ISFINITE = 0 instead of = 1.


2026-02-02  Bruno Haible  <[email protected]>

        isfinite-no-c++: Avoid unnecessary override of isfinite().
        * m4/isfinite.m4 (gl_ISFINITEL_WORKS): Link the test program with -lm if
        necessary.

diff --git a/m4/isfinite.m4 b/m4/isfinite.m4
index 44d97aa3f0..6515b648b6 100644
--- a/m4/isfinite.m4
+++ b/m4/isfinite.m4
@@ -1,5 +1,5 @@
 # isfinite.m4
-# serial 23
+# serial 24
 dnl Copyright (C) 2007-2026 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -53,6 +53,8 @@ AC_DEFUN([gl_ISFINITEL_WORKS]
   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   AC_CACHE_CHECK([whether isfinite(long double) works], 
[gl_cv_func_isfinitel_works],
     [
+      saved_LIBS="$LIBS"
+      LIBS="$LIBS $ISFINITE_LIBM"
       AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #include <float.h>
 #include <limits.h>
@@ -176,5 +178,6 @@ AC_DEFUN([gl_ISFINITEL_WORKS]
          *)                 gl_cv_func_isfinitel_works="guessing yes" ;;
        esac
       ])
+      LIBS="$saved_LIBS"
     ])
 ])




Reply via email to