Back out the <type_traits> changes from r198431; they were breaking when building with glibc. Need to find a better solution for PR18218.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@198623 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow 2014-01-06 18:12:50 +00:00
parent af6cd294aa
commit 908b5d7f92
2 changed files with 22 additions and 62 deletions

View File

@ -419,25 +419,12 @@ __libcpp_isnan(_A1 __x) _NOEXCEPT
#undef isnan #undef isnan
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
isnan(float __x) _NOEXCEPT isnan(_A1 __x) _NOEXCEPT
{ {
return __libcpp_isnan(__x); return __libcpp_isnan((typename std::__promote<_A1>::type)__x);
}
inline _LIBCPP_INLINE_VISIBILITY
bool
isnan(double __x) _NOEXCEPT
{
return __libcpp_isnan(__x);
}
inline _LIBCPP_INLINE_VISIBILITY
bool
isnan(long double __x) _NOEXCEPT
{
return __libcpp_isnan(__x);
} }
#endif // isnan #endif // isnan
@ -665,26 +652,6 @@ using ::isunordered;
using ::float_t; using ::float_t;
using ::double_t; using ::double_t;
// isnan
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<__promote<_A1>::value, bool>::type
#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
isnan(_A1 __x)
#else
isnan(_A1&& __x)
_NOEXCEPT_
(
_NOEXCEPT_(__promote<_A1>::__does_not_throw)
)
#endif
{
typedef typename __promote<_A1>::type type;
static_assert(!(is_same<typename remove_reference<_A1>::type, type>::value), "");
return __libcpp_isnan(static_cast<type>(_VSTD::forward<_A1>(__x)));
}
// abs // abs
#if !defined(_AIX) #if !defined(_AIX)
@ -985,25 +952,18 @@ inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __x, long double __
template <class _A1, class _A2> template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename __promote<_A1, _A2>::type typename enable_if
#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES <
pow(_A1 __x, _A2 __y) is_arithmetic<_A1>::value &&
#else is_arithmetic<_A2>::value,
pow(_A1&& __x, _A2&& __y) typename __promote<_A1, _A2>::type
_NOEXCEPT_ >::type
( pow(_A1 __x, _A2 __y) _NOEXCEPT
_NOEXCEPT_(__promote<_A1>::__does_not_throw) &&
_NOEXCEPT_(__promote<_A2>::__does_not_throw)
)
#endif
{ {
typedef typename __promote<_A1>::type _D1; typedef typename __promote<_A1, _A2>::type __result_type;
typedef typename __promote<_A2>::type _D2; static_assert((!(is_same<_A1, __result_type>::value &&
typedef typename __promote<_D1, _D2>::type type; is_same<_A2, __result_type>::value)), "");
static_assert((!(is_same<typename remove_reference<_A1>::type, type>::value && return pow((__result_type)__x, (__result_type)__y);
is_same<typename remove_reference<_A2>::type, type>::value)), "");
return pow(static_cast<type>(static_cast<_D1>(_VSTD::forward<_A1>(__x))),
static_cast<type>(static_cast<_D2>(_VSTD::forward<_A2>(__y))));
} }
// sin // sin

View File

@ -339,14 +339,14 @@ void test_pow()
static_assert((std::is_same<decltype(std::powf(0,0)), float>::value), ""); static_assert((std::is_same<decltype(std::powf(0,0)), float>::value), "");
static_assert((std::is_same<decltype(std::powl(0,0)), long double>::value), ""); static_assert((std::is_same<decltype(std::powl(0,0)), long double>::value), "");
static_assert((std::is_same<decltype(std::pow((int)0, (int)0)), double>::value), ""); static_assert((std::is_same<decltype(std::pow((int)0, (int)0)), double>::value), "");
static_assert((std::is_same<decltype(std::pow(Value<int>(), (int)0)), double>::value), ""); // static_assert((std::is_same<decltype(std::pow(Value<int>(), (int)0)), double>::value), "");
static_assert((std::is_same<decltype(std::pow(Value<long double>(), (float)0)), long double>::value), ""); // static_assert((std::is_same<decltype(std::pow(Value<long double>(), (float)0)), long double>::value), "");
static_assert((std::is_same<decltype(std::pow((float) 0, Value<float>())), float>::value), ""); // static_assert((std::is_same<decltype(std::pow((float) 0, Value<float>())), float>::value), "");
assert(std::pow(1,1) == 1); assert(std::pow(1,1) == 1);
assert(std::pow(Value<int,1>(), Value<float,1>()) == 1); // assert(std::pow(Value<int,1>(), Value<float,1>()) == 1);
assert(std::pow(1.0f, Value<double,1>()) == 1); // assert(std::pow(1.0f, Value<double,1>()) == 1);
assert(std::pow(1.0, Value<int,1>()) == 1); // assert(std::pow(1.0, Value<int,1>()) == 1);
assert(std::pow(Value<long double,1>(), 1LL) == 1); // assert(std::pow(Value<long double,1>(), 1LL) == 1);
} }
void test_sin() void test_sin()