Skip to content

Commit

Permalink
[libcxx] Stop using builtin type traits for is_floating_point and is_…
Browse files Browse the repository at this point in the history
…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).
  • Loading branch information
zoecarver committed Apr 1, 2020
1 parent 296ccef commit e6a39f0
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions libcxx/include/type_traits
Expand Up @@ -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 {};
Expand All @@ -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)
Expand Down Expand Up @@ -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 ||
Expand All @@ -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,
Expand Down

0 comments on commit e6a39f0

Please sign in to comment.