summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/numerics
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2018-05-01 03:05:40 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2018-05-01 03:05:40 +0000
commitc4f593ba1a72e0d9d74e440ea7e627e6b0f16689 (patch)
tree2264e88d0977c71285c2514a735a74802b309559 /libcxx/test/std/numerics
parent3678be89f7e6a8a94643e3807c78b84efcb389ef (diff)
downloadbcm5719-llvm-c4f593ba1a72e0d9d74e440ea7e627e6b0f16689.tar.gz
bcm5719-llvm-c4f593ba1a72e0d9d74e440ea7e627e6b0f16689.zip
Fix return type of isinf(double) and isnan(double) where possible.
When using an old version of glibc, a ::isinf(double) and ::isnan(double) function is provided, rather than just the macro required by C and C++. Displace this function using _LIBCPP_PREFERRED_OVERLOAD where possible. The only remaining case where we should get the wrong return type is now glibc + libc++ + a non-clang compiler. llvm-svn: 331241
Diffstat (limited to 'libcxx/test/std/numerics')
-rw-r--r--libcxx/test/std/numerics/c.math/cmath.pass.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/libcxx/test/std/numerics/c.math/cmath.pass.cpp b/libcxx/test/std/numerics/c.math/cmath.pass.cpp
index b5f586492bd..cc535e37439 100644
--- a/libcxx/test/std/numerics/c.math/cmath.pass.cpp
+++ b/libcxx/test/std/numerics/c.math/cmath.pass.cpp
@@ -661,11 +661,12 @@ void test_isinf()
static_assert((std::is_same<decltype(std::isinf((float)0)), bool>::value), "");
typedef decltype(std::isinf((double)0)) DoubleRetType;
-#ifndef __linux__
+#if !defined(__linux__) || defined(__clang__)
static_assert((std::is_same<DoubleRetType, bool>::value), "");
#else
- // GLIBC < 2.26 defines 'isinf(double)' with a return type of 'int' in
- // all C++ dialects. The test should tolerate this.
+ // GLIBC < 2.23 defines 'isinf(double)' with a return type of 'int' in
+ // all C++ dialects. The test should tolerate this when libc++ can't work
+ // around it.
// See: https://sourceware.org/bugzilla/show_bug.cgi?id=19439
static_assert((std::is_same<DoubleRetType, bool>::value
|| std::is_same<DoubleRetType, int>::value), "");
@@ -746,11 +747,12 @@ void test_isnan()
static_assert((std::is_same<decltype(std::isnan((float)0)), bool>::value), "");
typedef decltype(std::isnan((double)0)) DoubleRetType;
-#ifndef __linux__
+#if !defined(__linux__) || defined(__clang__)
static_assert((std::is_same<DoubleRetType, bool>::value), "");
#else
- // GLIBC < 2.26 defines 'isnan(double)' with a return type of 'int' in
- // all C++ dialects. The test should tolerate this.
+ // GLIBC < 2.23 defines 'isinf(double)' with a return type of 'int' in
+ // all C++ dialects. The test should tolerate this when libc++ can't work
+ // around it.
// See: https://sourceware.org/bugzilla/show_bug.cgi?id=19439
static_assert((std::is_same<DoubleRetType, bool>::value
|| std::is_same<DoubleRetType, int>::value), "");
OpenPOWER on IntegriCloud