From 4ac60ca3843747b99aba4a61a34c33d1f1487f2b Mon Sep 17 00:00:00 2001 From: dim Date: Sat, 17 Jan 2015 12:54:02 +0000 Subject: [PATCH] MFC r276517: Pull in r200010 from upstream libc++ trunk (by Marshall Clow): Rename some internal templates to avoid conflict with complier intrinsics. __is_constructible --> __libcpp_is_constructible, __is_nothrow_constructible --> __libcpp_is_nothrow_constructible, and __is_nothrow_assignable --> __libcpp_is_nothrow_assignable. No functionality change. Pull in r206805 from upstream libc++ trunk (by Marshall Clow): Use compiler intrinsic __is_constructible if available This should fix building parts of world with -std=c++11 enabled. Reported by: Oliver Hartmann git-svn-id: svn://svn.freebsd.org/base/stable/10@277299 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- contrib/libc++/include/type_traits | 70 +++++++++++++++++------------- 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/contrib/libc++/include/type_traits b/contrib/libc++/include/type_traits index 0f31e9371..fd6aa05e8 100644 --- a/contrib/libc++/include/type_traits +++ b/contrib/libc++/include/type_traits @@ -2015,10 +2015,24 @@ class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0, _A1, _A2)> #endif // _LIBCPP_HAS_NO_VARIADICS -#ifndef _LIBCPP_HAS_NO_VARIADICS - // template struct is_constructible; +namespace __is_construct +{ +struct __nat {}; +} + +#if __has_feature(is_constructible) + +template +struct _LIBCPP_TYPE_VIS_ONLY is_constructible + : public integral_constant + {}; + +#else + +#ifndef _LIBCPP_HAS_NO_VARIADICS + // main is_constructible test template @@ -2030,7 +2044,7 @@ false_type __is_constructible_test(__any, _Args&& ...); template -struct __is_constructible // false, _Tp is not a scalar +struct __libcpp_is_constructible // false, _Tp is not a scalar : public common_type < decltype(__is_constructible_test(declval<_Tp>(), declval<_Args>()...)) @@ -2040,7 +2054,7 @@ struct __is_constructible // false, _Tp is not a scalar // function types are not constructible template -struct __is_constructible +struct __libcpp_is_constructible : public false_type {}; @@ -2049,7 +2063,7 @@ struct __is_constructible // Scalars are default constructible, references are not template -struct __is_constructible +struct __libcpp_is_constructible : public is_scalar<_Tp> {}; @@ -2064,7 +2078,7 @@ struct __is_constructible_ref }; template -struct __is_constructible +struct __libcpp_is_constructible : public common_type < decltype(__is_constructible_ref<_Tp>::__lxx(declval<_A0>())) @@ -2074,7 +2088,7 @@ struct __is_constructible // Scalars and references are not constructible from multiple args. template -struct __is_constructible +struct __libcpp_is_constructible : public false_type {}; @@ -2082,7 +2096,7 @@ struct __is_constructible template struct __is_constructible_void_check - : public __is_constructible::value || is_reference<_Tp>::value, + : public __libcpp_is_constructible::value || is_reference<_Tp>::value, _Tp, _Args...> {}; @@ -2117,21 +2131,21 @@ struct _LIBCPP_TYPE_VIS_ONLY is_constructible // is default constructible template -struct __is_constructible +struct __libcpp_is_constructible : public is_constructible::type> {}; // Otherwise array types are not constructible by this syntax template -struct __is_constructible +struct __libcpp_is_constructible : public false_type {}; // Incomplete array types are not constructible template -struct __is_constructible +struct __libcpp_is_constructible : public false_type {}; @@ -2246,13 +2260,6 @@ struct __is_constructible2_void_check // is_constructible entry point -namespace __is_construct -{ - -struct __nat {}; - -} - template struct _LIBCPP_TYPE_VIS_ONLY is_constructible @@ -2317,6 +2324,7 @@ struct __is_constructible2_imp {}; #endif // _LIBCPP_HAS_NO_VARIADICS +#endif // __has_feature(is_constructible) // is_default_constructible @@ -2581,29 +2589,29 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible #if __has_feature(cxx_noexcept) -template struct __is_nothrow_constructible; +template struct __libcpp_is_nothrow_constructible; template -struct __is_nothrow_constructible +struct __libcpp_is_nothrow_constructible : public integral_constant()...))> { }; template -struct __is_nothrow_constructible +struct __libcpp_is_nothrow_constructible : public false_type { }; template struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible - : __is_nothrow_constructible::value, _Tp, _Args...> + : __libcpp_is_nothrow_constructible::value, _Tp, _Args...> { }; template struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp[_Ns]> - : __is_nothrow_constructible::value, _Tp> + : __libcpp_is_nothrow_constructible::value, _Tp> { }; @@ -2743,23 +2751,23 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_constructible #if __has_feature(cxx_noexcept) -template struct __is_nothrow_assignable; +template struct __libcpp_is_nothrow_assignable; template -struct __is_nothrow_assignable +struct __libcpp_is_nothrow_assignable : public false_type { }; template -struct __is_nothrow_assignable +struct __libcpp_is_nothrow_assignable : public integral_constant() = _VSTD::declval<_Arg>()) > { }; template struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable - : public __is_nothrow_assignable::value, _Tp, _Arg> + : public __libcpp_is_nothrow_assignable::value, _Tp, _Arg> { }; @@ -2829,23 +2837,23 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_assignable #if __has_feature(cxx_noexcept) -template struct __is_nothrow_destructible; +template struct __libcpp_is_nothrow_destructible; template -struct __is_nothrow_destructible +struct __libcpp_is_nothrow_destructible : public false_type { }; template -struct __is_nothrow_destructible +struct __libcpp_is_nothrow_destructible : public integral_constant().~_Tp()) > { }; template struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible - : public __is_nothrow_destructible::value, _Tp> + : public __libcpp_is_nothrow_destructible::value, _Tp> { }; -- 2.45.0