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 <ohartman@zedat.fu-berlin.de>
MFC after:	1 week
This commit is contained in:
dim 2015-01-01 22:49:17 +00:00
parent ec84358430
commit 4eb40d1e51

View File

@ -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 <class T, class... Args> struct is_constructible;
namespace __is_construct
{
struct __nat {};
}
#if __has_feature(is_constructible)
template <class _Tp, class ..._Args>
struct _LIBCPP_TYPE_VIS_ONLY is_constructible
: public integral_constant<bool, __is_constructible(_Tp, _Args...)>
{};
#else
#ifndef _LIBCPP_HAS_NO_VARIADICS
// main is_constructible test
template <class _Tp, class ..._Args>
@ -2030,7 +2044,7 @@ false_type
__is_constructible_test(__any, _Args&& ...);
template <bool, class _Tp, class... _Args>
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 <class _Rp, class... _A1, class... _A2>
struct __is_constructible<false, _Rp(_A1...), _A2...>
struct __libcpp_is_constructible<false, _Rp(_A1...), _A2...>
: public false_type
{};
@ -2049,7 +2063,7 @@ struct __is_constructible<false, _Rp(_A1...), _A2...>
// Scalars are default constructible, references are not
template <class _Tp>
struct __is_constructible<true, _Tp>
struct __libcpp_is_constructible<true, _Tp>
: public is_scalar<_Tp>
{};
@ -2064,7 +2078,7 @@ struct __is_constructible_ref
};
template <class _Tp, class _A0>
struct __is_constructible<true, _Tp, _A0>
struct __libcpp_is_constructible<true, _Tp, _A0>
: public common_type
<
decltype(__is_constructible_ref<_Tp>::__lxx(declval<_A0>()))
@ -2074,7 +2088,7 @@ struct __is_constructible<true, _Tp, _A0>
// Scalars and references are not constructible from multiple args.
template <class _Tp, class _A0, class ..._Args>
struct __is_constructible<true, _Tp, _A0, _Args...>
struct __libcpp_is_constructible<true, _Tp, _A0, _Args...>
: public false_type
{};
@ -2082,7 +2096,7 @@ struct __is_constructible<true, _Tp, _A0, _Args...>
template <bool, class _Tp, class... _Args>
struct __is_constructible_void_check
: public __is_constructible<is_scalar<_Tp>::value || is_reference<_Tp>::value,
: public __libcpp_is_constructible<is_scalar<_Tp>::value || is_reference<_Tp>::value,
_Tp, _Args...>
{};
@ -2117,21 +2131,21 @@ struct _LIBCPP_TYPE_VIS_ONLY is_constructible
// is default constructible
template <class _Ap, size_t _Np>
struct __is_constructible<false, _Ap[_Np]>
struct __libcpp_is_constructible<false, _Ap[_Np]>
: public is_constructible<typename remove_all_extents<_Ap>::type>
{};
// Otherwise array types are not constructible by this syntax
template <class _Ap, size_t _Np, class ..._Args>
struct __is_constructible<false, _Ap[_Np], _Args...>
struct __libcpp_is_constructible<false, _Ap[_Np], _Args...>
: public false_type
{};
// Incomplete array types are not constructible
template <class _Ap, class ..._Args>
struct __is_constructible<false, _Ap[], _Args...>
struct __libcpp_is_constructible<false, _Ap[], _Args...>
: public false_type
{};
@ -2246,13 +2260,6 @@ struct __is_constructible2_void_check<true, _Tp, _A0, _A1>
// is_constructible entry point
namespace __is_construct
{
struct __nat {};
}
template <class _Tp, class _A0 = __is_construct::__nat,
class _A1 = __is_construct::__nat>
struct _LIBCPP_TYPE_VIS_ONLY is_constructible
@ -2317,6 +2324,7 @@ struct __is_constructible2_imp<false, _Ap[], _A0, _A1>
{};
#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 <bool, class _Tp, class... _Args> struct __is_nothrow_constructible;
template <bool, class _Tp, class... _Args> struct __libcpp_is_nothrow_constructible;
template <class _Tp, class... _Args>
struct __is_nothrow_constructible<true, _Tp, _Args...>
struct __libcpp_is_nothrow_constructible<true, _Tp, _Args...>
: public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))>
{
};
template <class _Tp, class... _Args>
struct __is_nothrow_constructible<false, _Tp, _Args...>
struct __libcpp_is_nothrow_constructible<false, _Tp, _Args...>
: public false_type
{
};
template <class _Tp, class... _Args>
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible
: __is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, _Tp, _Args...>
: __libcpp_is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, _Tp, _Args...>
{
};
template <class _Tp, size_t _Ns>
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp[_Ns]>
: __is_nothrow_constructible<is_constructible<_Tp>::value, _Tp>
: __libcpp_is_nothrow_constructible<is_constructible<_Tp>::value, _Tp>
{
};
@ -2743,23 +2751,23 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_constructible
#if __has_feature(cxx_noexcept)
template <bool, class _Tp, class _Arg> struct __is_nothrow_assignable;
template <bool, class _Tp, class _Arg> struct __libcpp_is_nothrow_assignable;
template <class _Tp, class _Arg>
struct __is_nothrow_assignable<false, _Tp, _Arg>
struct __libcpp_is_nothrow_assignable<false, _Tp, _Arg>
: public false_type
{
};
template <class _Tp, class _Arg>
struct __is_nothrow_assignable<true, _Tp, _Arg>
struct __libcpp_is_nothrow_assignable<true, _Tp, _Arg>
: public integral_constant<bool, noexcept(_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>()) >
{
};
template <class _Tp, class _Arg>
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable
: public __is_nothrow_assignable<is_assignable<_Tp, _Arg>::value, _Tp, _Arg>
: public __libcpp_is_nothrow_assignable<is_assignable<_Tp, _Arg>::value, _Tp, _Arg>
{
};
@ -2829,23 +2837,23 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_assignable
#if __has_feature(cxx_noexcept)
template <bool, class _Tp> struct __is_nothrow_destructible;
template <bool, class _Tp> struct __libcpp_is_nothrow_destructible;
template <class _Tp>
struct __is_nothrow_destructible<false, _Tp>
struct __libcpp_is_nothrow_destructible<false, _Tp>
: public false_type
{
};
template <class _Tp>
struct __is_nothrow_destructible<true, _Tp>
struct __libcpp_is_nothrow_destructible<true, _Tp>
: public integral_constant<bool, noexcept(_VSTD::declval<_Tp>().~_Tp()) >
{
};
template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible
: public __is_nothrow_destructible<is_destructible<_Tp>::value, _Tp>
: public __libcpp_is_nothrow_destructible<is_destructible<_Tp>::value, _Tp>
{
};