[PATCH] Fix libstdc++-v3/include/math.h:66:1 2: error: 'constexpr bool std::isnan(double)' conflicts with a previous declaration

Jonathan Wakely jwakely@redhat.com
Thu Feb 4 22:49:00 GMT 2016

On 04/02/16 23:11 +0100, Gerald Pfeifer wrote:
>It seems to break older versions of FreeBSD that have GCC 4.2
>as their system compiler.  (Those versions aren't actually all
>that old, they are stuck with GCC 4.2 as the last version under

The version of GCC doesn't matter, it's whether libc declares those
functions or not.

I tested the change on modern versions of FreeBSD and DragonFly which
have the following so don't declare them:

 * Version 2 of the Single UNIX Specification (UNIX98) defined isnan() and
 * isinf() as functions taking double.  C99, and the subsequent POSIX revisions
 * (SUSv3, POSIX.1-2001, define it as a macro that accepts any real floating
 * point type.  If we are targeting SUSv2 and C99 or C11 (or C++11) then we
 * expose the newer definition, assuming that the language spec takes
 * precedence over the operating system interface spec.
#if     __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600 && __ISO_C_VISIBLE < 1999
#undef isinf
#undef isnan
int     isinf(double);
int     isnan(double);

I'll enable the configure test for all targets and check that it's OK
on these ones which definitely don't declare the obsolete functions.
It should also fix it on systems that do declare them.

More information about the Libstdc++ mailing list