diff --git a/src/include/port.h b/src/include/port.h index 74a9dc4d4d5..0ce72e50e5e 100644 --- a/src/include/port.h +++ b/src/include/port.h @@ -347,15 +347,18 @@ extern int isinf(double x); /* * Glibc doesn't use the builtin for clang due to a *gcc* bug in a version * newer than the gcc compatibility clang claims to have. This would cause a - * *lot* of superfluous function calls, therefore revert when using clang. + * *lot* of superfluous function calls, therefore revert when using clang. In + * C++ there's issues with libc++ (not libstdc++), so disable as well. */ -#ifdef __clang__ +#if defined(__clang__) && !defined(__cplusplus) /* needs to be separate to not confuse other compilers */ #if __has_builtin(__builtin_isinf) +/* need to include before, to avoid getting overwritten */ +#include #undef isinf #define isinf __builtin_isinf #endif /* __has_builtin(isinf) */ -#endif /* __clang__ */ +#endif /* __clang__ && !__cplusplus*/ #endif /* !HAVE_ISINF */ #ifndef HAVE_MKDTEMP