summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2012-08-17 17:54:11 +0000
committerHoward Hinnant <hhinnant@apple.com>2012-08-17 17:54:11 +0000
commita0b42cacbfce983dddce58b00f46793ab5de1975 (patch)
tree15b78cee912a0ffbfc408c4fa13ea01ee449726e
parent2018618b4dfd07b7aa9b24e103f83390e5185ab7 (diff)
downloadbcm5719-llvm-a0b42cacbfce983dddce58b00f46793ab5de1975.tar.gz
bcm5719-llvm-a0b42cacbfce983dddce58b00f46793ab5de1975.zip
Apply patches supplied by Michel Morin in http://llvm.org/bugs/show_bug.cgi?id=13601 to correct bugs in is_convertible for the case that the intrinsic __is_convertible_to is not available.
llvm-svn: 162111
-rw-r--r--libcxx/include/type_traits12
1 files changed, 8 insertions, 4 deletions
diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits
index 62b214962f4..7b5827c5d5c 100644
--- a/libcxx/include/type_traits
+++ b/libcxx/include/type_traits
@@ -619,11 +619,7 @@ template <class _T1, class _T2> struct _LIBCPP_VISIBLE is_convertible
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();
@@ -658,7 +654,14 @@ template <class _T1, class _T2,
unsigned _T2_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T2>::value>
struct __is_convertible
: public integral_constant<bool,
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
sizeof(__is_convertible_imp::__test<_T2>(__is_convertible_imp::__source<_T1>())) == 1
+#else
+ sizeof(__is_convertible_imp::__test<_T2>(__is_convertible_imp::__source<_T1>())) == 1
+ && !(!is_function<_T1>::value && !is_reference<_T1>::value && is_reference<_T2>::value
+ && (!is_const<typename remove_reference<_T2>::type>::value
+ || is_volatile<typename remove_reference<_T2>::type>::value))
+#endif
>
{};
@@ -688,6 +691,7 @@ template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 0>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _T1> struct __is_convertible<_T1, _T1&&, 2, 0> : public true_type {};
#endif
+template <class _T1> struct __is_convertible<_T1, _T1&, 2, 0> : public true_type {};
template <class _T1> struct __is_convertible<_T1, _T1*, 2, 0> : public true_type {};
template <class _T1> struct __is_convertible<_T1, _T1*const, 2, 0> : public true_type {};
template <class _T1> struct __is_convertible<_T1, _T1*volatile, 2, 0> : public true_type {};
OpenPOWER on IntegriCloud