Hook up to the new clang __is_trivially_constructible and __is_trivially_assignable traits. Fixes r10925427 and http://llvm.org/bugs/show_bug.cgi?id=12038.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151406 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant
2012-02-24 23:32:26 +00:00
parent b9344c218b
commit 4300839b5f
3 changed files with 81 additions and 59 deletions

View File

@@ -2219,6 +2219,16 @@ struct _LIBCPP_VISIBLE is_move_constructible
#ifndef _LIBCPP_HAS_NO_VARIADICS
#if __has_feature(is_trivially_constructible)
template <class _Tp, class... _Args>
struct _LIBCPP_VISIBLE is_trivially_constructible
: integral_constant<bool, __is_trivially_constructible(_Tp, _Args...)>
{
};
#else // !__has_feature(is_trivially_constructible)
template <class _Tp, class... _Args>
struct _LIBCPP_VISIBLE is_trivially_constructible
: false_type
@@ -2241,34 +2251,24 @@ struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&&>
#else
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp>
#endif
#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
: integral_constant<bool, __has_trivial_copy(_Tp)>
#else
: integral_constant<bool, is_scalar<_Tp>::value>
#endif
{
};
template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&>
#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
: integral_constant<bool, __has_trivial_copy(_Tp)>
#else
: integral_constant<bool, is_scalar<_Tp>::value>
#endif
{
};
template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&>
#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
: integral_constant<bool, __has_trivial_copy(_Tp)>
#else
: integral_constant<bool, is_scalar<_Tp>::value>
#endif
{
};
#endif // !__has_feature(is_trivially_constructible)
#else // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _A0 = __is_construct::__nat,
@@ -2278,50 +2278,68 @@ struct _LIBCPP_VISIBLE is_trivially_constructible
{
};
#if __has_feature(is_trivially_constructible)
template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, __is_construct::__nat,
__is_construct::__nat>
#if __has_feature(has_trivial_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
: integral_constant<bool, __has_trivial_constructor(_Tp)>
#else
: integral_constant<bool, is_scalar<_Tp>::value>
#endif
: integral_constant<bool, __is_trivially_constructible(_Tp)>
{
};
template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp,
__is_construct::__nat>
#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
: integral_constant<bool, __has_trivial_copy(_Tp)>
#else
: integral_constant<bool, is_scalar<_Tp>::value>
#endif
: integral_constant<bool, __is_trivially_constructible(_Tp, _Tp)>
{
};
template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&,
__is_construct::__nat>
#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
: integral_constant<bool, __has_trivial_copy(_Tp)>
#else
: integral_constant<bool, is_scalar<_Tp>::value>
#endif
: integral_constant<bool, __is_trivially_constructible(_Tp, const _Tp&)>
{
};
template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&,
__is_construct::__nat>
#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
: integral_constant<bool, __has_trivial_copy(_Tp)>
#else
: integral_constant<bool, is_scalar<_Tp>::value>
#endif
: integral_constant<bool, __is_trivially_constructible(_Tp, _Tp&)>
{
};
#else // !__has_feature(is_trivially_constructible)
template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, __is_construct::__nat,
__is_construct::__nat>
: integral_constant<bool, is_scalar<_Tp>::value>
{
};
template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp,
__is_construct::__nat>
: integral_constant<bool, is_scalar<_Tp>::value>
{
};
template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&,
__is_construct::__nat>
: integral_constant<bool, is_scalar<_Tp>::value>
{
};
template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&,
__is_construct::__nat>
: integral_constant<bool, is_scalar<_Tp>::value>
{
};
#endif // !__has_feature(is_trivially_constructible)
#endif // _LIBCPP_HAS_NO_VARIADICS
// is_trivially_default_constructible
@@ -2348,46 +2366,42 @@ template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_move_constructible
// is_trivially_assignable
#if __has_feature(is_trivially_constructible)
template <class _Tp, class _Arg>
struct is_trivially_assignable
: integral_constant<bool, __is_trivially_assignable(_Tp, _Arg)>
{
};
#else // !__has_feature(is_trivially_constructible)
template <class _Tp, class _Arg>
struct is_trivially_assignable
: public false_type {};
template <class _Tp>
struct is_trivially_assignable<_Tp&, _Tp>
#if __has_feature(has_trivial_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
: integral_constant<bool, __has_trivial_assign(_Tp)> {};
#else
: integral_constant<bool, is_scalar<_Tp>::value> {};
#endif
template <class _Tp>
struct is_trivially_assignable<_Tp&, _Tp&>
#if __has_feature(has_trivial_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
: integral_constant<bool, __has_trivial_assign(_Tp)> {};
#else
: integral_constant<bool, is_scalar<_Tp>::value> {};
#endif
template <class _Tp>
struct is_trivially_assignable<_Tp&, const _Tp&>
#if __has_feature(has_trivial_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
: integral_constant<bool, __has_trivial_assign(_Tp)> {};
#else
: integral_constant<bool, is_scalar<_Tp>::value> {};
#endif
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp>
struct is_trivially_assignable<_Tp&, _Tp&&>
#if __has_feature(has_trivial_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
: integral_constant<bool, __has_trivial_assign(_Tp)> {};
#else
: integral_constant<bool, is_scalar<_Tp>::value> {};
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif // !__has_feature(is_trivially_constructible)
// is_trivially_copy_assignable
template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_copy_assignable