Browse Source

Reverted previous fix to is_convertible as it caused more problems than it fixed. But this reverted fix will only matter for non-clang compilers. Installed __is_convertible_to for clang.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@124429 91177308-0d34-0410-b5e6-96231b3b80d8
Howard Hinnant 14 years ago
parent
commit
091c5ace78
1 changed files with 15 additions and 0 deletions
  1. 15 0
      include/type_traits

+ 15 - 0
include/type_traits

@@ -598,9 +598,22 @@ template <class _Tp> struct _LIBCPP_VISIBLE is_abstract : public __libcpp_abstra
 
 // is_convertible
 
+#ifdef __clang__
+
+template <class _T1, class _T2> struct _LIBCPP_VISIBLE is_convertible
+    : public integral_constant<bool, __is_convertible_to(_T1, _T2)> {};
+{
+};
+
+#else  // __clang__
+
 namespace __is_convertible_imp
 {
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+template <class _Tp> char  __test(const volatile typename remove_reference<_Tp>::type&&);
+#else
 template <class _Tp> char  __test(_Tp);
+#endif
 template <class _Tp> __two __test(...);
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 template <class _Tp> _Tp&& __source();
@@ -694,6 +707,8 @@ template <class _T1, class _T2> struct _LIBCPP_VISIBLE is_convertible
     static const size_t __complete_check2 = __is_convertible_check<_T2>::__v;
 };
 
+#endif  // __clang__
+
 // is_base_of
 
 //  (C) Copyright Rani Sharoni 2003.