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.

llvm-svn: 333108
This commit is contained in:
Akira Hatanaka 2018-05-23 17:50:41 +00:00
parent 3f66363139
commit 7b9bee064a
2 changed files with 4 additions and 0 deletions

View File

@ -733,7 +733,9 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_integral_v
// 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

View File

@ -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