Index: include/math.h =================================================================== --- include/math.h +++ include/math.h @@ -302,6 +302,10 @@ #ifdef __cplusplus +#if 201103L <= __cplusplus + #define __LIBCPP_USE_C99_MATH 1 +#endif + // We support including .h headers inside 'extern "C"' contexts, so switch // back to C++ linkage before including these C++ headers. extern "C++" { @@ -946,7 +950,7 @@ // acosh -#ifndef _LIBCPP_MSVCRT +#if !defined(_LIBCPP_MSVCRT) && defined(__LIBCPP_USE_C99_MATH) inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return acoshf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return acoshl(__lcpp_x);} @@ -958,7 +962,7 @@ // asinh -#ifndef _LIBCPP_MSVCRT +#if !defined(_LIBCPP_MSVCRT) && defined(__LIBCPP_USE_C99_MATH) inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return asinhf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return asinhl(__lcpp_x);} @@ -970,7 +974,7 @@ // atanh -#ifndef _LIBCPP_MSVCRT +#if !defined(_LIBCPP_MSVCRT) && defined(__LIBCPP_USE_C99_MATH) inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return atanhf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return atanhl(__lcpp_x);} @@ -982,7 +986,7 @@ // cbrt -#ifndef _LIBCPP_MSVCRT +#if !defined(_LIBCPP_MSVCRT) && defined(__LIBCPP_USE_C99_MATH) inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return cbrtf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return cbrtl(__lcpp_x);} @@ -994,7 +998,7 @@ // copysign -#if !defined(_VC_CRT_MAJOR_VERSION) || (_VC_CRT_MAJOR_VERSION < 12) +#if defined(__LIBCPP_USE_C99_MATH) && (!defined(_VC_CRT_MAJOR_VERSION) || (_VC_CRT_MAJOR_VERSION < 12)) inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x, float __lcpp_y) _NOEXCEPT { return copysignf(__lcpp_x, __lcpp_y); @@ -1005,6 +1009,7 @@ } #endif +#if defined(__LIBCPP_USE_C99_MATH) template inline _LIBCPP_INLINE_VISIBILITY typename std::__lazy_enable_if @@ -1020,9 +1025,9 @@ std::is_same<_A2, __result_type>::value)), ""); return copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y); } +#endif -#ifndef _LIBCPP_MSVCRT - +#if !defined(_LIBCPP_MSVCRT) && defined(__LIBCPP_USE_C99_MATH) // erf inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return erff(__lcpp_x);} Index: test/std/depr/depr.c.headers/math_h.pass.cpp =================================================================== --- test/std/depr/depr.c.headers/math_h.pass.cpp +++ test/std/depr/depr.c.headers/math_h.pass.cpp @@ -750,6 +750,8 @@ assert(isunordered(-1.0, 0.F) == false); } +#if TEST_STD_VER > 3 + void test_acosh() { static_assert((std::is_same::value), ""); @@ -1455,6 +1457,8 @@ assert(trunc(1) == 1); } +#endif + int main() { test_abs(); @@ -1492,6 +1496,7 @@ test_islessgreater(); test_isnan(); test_isunordered(); +#if TEST_STD_VER > 3 test_acosh(); test_asinh(); test_atanh(); @@ -1527,4 +1532,5 @@ test_scalbn(); test_tgamma(); test_trunc(); +#endif } Index: test/std/numerics/c.math/cmath.pass.cpp =================================================================== --- test/std/numerics/c.math/cmath.pass.cpp +++ test/std/numerics/c.math/cmath.pass.cpp @@ -752,6 +752,8 @@ assert(std::isunordered(-1.0, 0.F) == false); } +#if TEST_STD_VER > 3 + void test_acosh() { static_assert((std::is_same::value), ""); @@ -1479,6 +1481,8 @@ assert(std::trunc(1) == 1); } +#endif + int main() { test_abs(); @@ -1516,6 +1520,7 @@ test_islessgreater(); test_isnan(); test_isunordered(); +#if TEST_STD_VER > 3 test_acosh(); test_asinh(); test_atanh(); @@ -1551,4 +1556,5 @@ test_scalbn(); test_tgamma(); test_trunc(); +#endif } Index: test/std/numerics/complex.number/cmplx.over/proj.pass.cpp =================================================================== --- test/std/numerics/complex.number/cmplx.over/proj.pass.cpp +++ test/std/numerics/complex.number/cmplx.over/proj.pass.cpp @@ -34,7 +34,9 @@ test(T x, typename std::enable_if::value>::type* = 0) { static_assert((std::is_same >::value), ""); +#if TEST_STD_VER > 3 assert(std::proj(x) == proj(std::complex(x, 0))); +#endif } template @@ -43,7 +45,9 @@ !std::is_floating_point::value>::type* = 0) { static_assert((std::is_same >::value), ""); +#if TEST_STD_VER > 3 assert(std::proj(x) == proj(std::complex(x, 0))); +#endif } template