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

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 1 16:57:28 PDT 2020


Author: zoecarver
Date: 2020-04-01T16:57:08-07:00
New Revision: e6a39f00e8d0cd3684df54fb03d288efe2969202

URL: https://github.com/llvm/llvm-project/commit/e6a39f00e8d0cd3684df54fb03d288efe2969202
DIFF: https://github.com/llvm/llvm-project/commit/e6a39f00e8d0cd3684df54fb03d288efe2969202.diff

LOG: [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).

Added: 
    

Modified: 
    libcxx/include/type_traits

Removed: 
    


################################################################################
diff  --git a/libcxx/include/type_traits b/libcxx/include/type_traits
index 8fdf4a4939d1..15e9df2ea269 100644
--- a/libcxx/include/type_traits
+++ b/libcxx/include/type_traits
@@ -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,


        


More information about the libcxx-commits mailing list