[libcxx] r333108 - Do not define template specialization __libcpp_is_floating_point<__fp16>

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Wed May 23 10:50:41 PDT 2018


Author: ahatanak
Date: Wed May 23 10:50:41 2018
New Revision: 333108

URL: http://llvm.org/viewvc/llvm-project?rev=333108&view=rev
Log:
Do not define template specialization __libcpp_is_floating_point<__fp16>
if the compiler is not clang.

gcc doesn't allow using __fp16 on non-ARM targets.

Modified:
    libcxx/trunk/include/type_traits
    libcxx/trunk/test/libcxx/type_traits/is_floating_point.pass.cpp

Modified: libcxx/trunk/include/type_traits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=333108&r1=333107&r2=333108&view=diff
==============================================================================
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Wed May 23 10:50:41 2018
@@ -733,7 +733,9 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR boo
 // is_floating_point
 
 template <class _Tp> struct __libcpp_is_floating_point              : public false_type {};
+#ifdef __clang__
 template <>          struct __libcpp_is_floating_point<__fp16>      : public true_type {};
+#endif
 #ifdef __FLT16_MANT_DIG__
 template <>          struct __libcpp_is_floating_point<_Float16>    : public true_type {};
 #endif

Modified: libcxx/trunk/test/libcxx/type_traits/is_floating_point.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/type_traits/is_floating_point.pass.cpp?rev=333108&r1=333107&r2=333108&view=diff
==============================================================================
--- libcxx/trunk/test/libcxx/type_traits/is_floating_point.pass.cpp (original)
+++ libcxx/trunk/test/libcxx/type_traits/is_floating_point.pass.cpp Wed May 23 10:50:41 2018
@@ -14,7 +14,9 @@
 #include <type_traits>
 
 int main() {
+#ifdef __clang__
   static_assert(std::is_floating_point<__fp16>::value, "");
+#endif
 #ifdef __FLT16_MANT_DIG__
   static_assert(std::is_floating_point<_Float16>::value, "");
 #endif




More information about the cfe-commits mailing list