[libcxx] Stop using builtin type traits for is_floating_point and is_arithmetic.

Based on an issue brought up in https://reviews.llvm.org/D67900, this commit reverts the changes to is_floating_point and  is_arithmetic made in D67900.

After D67900 landed, __float128 behaved differently in those two type traits, causing compiler errors in numeric limits (and possibly others).
This commit is contained in:
zoecarver 2020-04-01 16:56:12 -07:00
parent 296ccef703
commit e6a39f00e8

View File

@ -852,18 +852,6 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_integral_v
// is_floating_point
#if __has_keyword(__is_floating_point)
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_floating_point : _BoolConstant<__is_floating_point(_Tp)> { };
#if _LIBCPP_STD_VER > 14
template <class _Tp>
_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_floating_point_v = __is_floating_point(_Tp);
#endif
#else
template <class _Tp> struct __libcpp_is_floating_point : public false_type {};
template <> struct __libcpp_is_floating_point<float> : public true_type {};
template <> struct __libcpp_is_floating_point<double> : public true_type {};
@ -878,8 +866,6 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_floating_point_v
= is_floating_point<_Tp>::value;
#endif
#endif // __has_keyword(__is_floating_point)
// is_array
#if __has_keyword(__is_array)
@ -1192,17 +1178,6 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_enum_v
// is_arithmetic
#if __has_keyword(__is_arithmetic)
template<class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_arithmetic : _BoolConstant<__is_arithmetic(_Tp)> { };
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp>
_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_arithmetic_v = __is_arithmetic(_Tp);
#endif
#else // __has_keyword(__is_arithmetic)
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_arithmetic
: public integral_constant<bool, is_integral<_Tp>::value ||
@ -1214,8 +1189,6 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_arithmetic_v
= is_arithmetic<_Tp>::value;
#endif
#endif // __has_keyword(__is_arithmetic)
// is_fundamental
// In clang 9 and lower, this builtin did not work for nullptr_t. Additionally, in C++03 mode,