diff --git a/include/__config b/include/__config index f2460665f..4dde70ad1 100644 --- a/include/__config +++ b/include/__config @@ -86,6 +86,8 @@ #if defined(__clang__) +#undef __STRICT_ANSI__ + #define _LIBCPP_HAS_NO_ADVANCED_SFINAE #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES diff --git a/include/__split_buffer b/include/__split_buffer index e3c2b9dd0..88e2c8375 100644 --- a/include/__split_buffer +++ b/include/__split_buffer @@ -118,12 +118,12 @@ public: __construct_at_end(_ForwardIterator __first, _ForwardIterator __last); _LIBCPP_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin) - {__destruct_at_begin(__new_begin, has_trivial_destructor());} + {__destruct_at_begin(__new_begin, is_trivially_destructible());} void __destruct_at_begin(pointer __new_begin, false_type); void __destruct_at_begin(pointer __new_begin, true_type); _LIBCPP_INLINE_VISIBILITY void __destruct_at_end(pointer __new_last) - {__destruct_at_end(__new_last, has_trivial_destructor());} + {__destruct_at_end(__new_last, is_trivially_destructible());} void __destruct_at_end(pointer __new_last, false_type); void __destruct_at_end(pointer __new_last, true_type); @@ -230,8 +230,8 @@ _LIBCPP_INLINE_VISIBILITY inline void __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x) { - __construct_at_end(__n, __x, integral_constant::value && - has_trivial_copy_assign::value>()); + __construct_at_end(__n, __x, integral_constant::value && + is_trivially_copy_assignable::value>()); } template diff --git a/include/algorithm b/include/algorithm index 17e20daed..a3764dfd0 100644 --- a/include/algorithm +++ b/include/algorithm @@ -1438,7 +1438,7 @@ template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - has_trivial_copy_assign<_Tp>::value, + is_trivially_copy_assignable<_Tp>::value, _Tp* >::type __unwrap_iter(move_iterator<_Tp*> __i) @@ -1450,7 +1450,7 @@ template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - has_trivial_copy_assign<_Tp>::value, + is_trivially_copy_assignable<_Tp>::value, _Tp* >::type __unwrap_iter(__wrap_iter<_Tp*> __i) @@ -1473,7 +1473,7 @@ inline _LIBCPP_INLINE_VISIBILITY typename enable_if < is_same::type, _Up>::value && - has_trivial_copy_assign<_Up>::value, + is_trivially_copy_assignable<_Up>::value, _Up* >::type __copy(_Tp* __first, _Tp* __last, _Up* __result) @@ -1508,7 +1508,7 @@ inline _LIBCPP_INLINE_VISIBILITY typename enable_if < is_same::type, _Up>::value && - has_trivial_copy_assign<_Up>::value, + is_trivially_copy_assignable<_Up>::value, _Up* >::type __copy_backward(_Tp* __first, _Tp* __last, _Up* __result) @@ -1593,7 +1593,7 @@ inline _LIBCPP_INLINE_VISIBILITY typename enable_if < is_same::type, _Up>::value && - has_trivial_copy_assign<_Up>::value, + is_trivially_copy_assignable<_Up>::value, _Up* >::type __move(_Tp* __first, _Tp* __last, _Up* __result) @@ -1628,7 +1628,7 @@ inline _LIBCPP_INLINE_VISIBILITY typename enable_if < is_same::type, _Up>::value && - has_trivial_copy_assign<_Up>::value, + is_trivially_copy_assignable<_Up>::value, _Up* >::type __move_backward(_Tp* __first, _Tp* __last, _Up* __result) @@ -1766,7 +1766,7 @@ fill_n(_OutputIterator __first, _Size __n, const _Tp& __value) { return _STD::__fill_n(__first, __n, __value, integral_constant::value && - has_trivial_copy_assign<_Tp>::value && + is_trivially_copy_assignable<_Tp>::value && sizeof(_Tp) == 1>()); } @@ -2169,7 +2169,7 @@ rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __l typename iterator_traits<_ForwardIterator>::iterator_category, random_access_iterator_tag >::value && - has_trivial_copy_assign + is_trivially_copy_assignable < typename iterator_traits<_ForwardIterator>::value_type >::value @@ -3434,8 +3434,8 @@ __sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __c // _Compare is known to be a reference type typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; - const difference_type __limit = has_trivial_copy_constructor::value && - has_trivial_copy_assign::value ? 30 : 6; + const difference_type __limit = is_trivially_copy_constructible::value && + is_trivially_copy_assignable::value ? 30 : 6; while (true) { __restart: @@ -4069,7 +4069,7 @@ __inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, template struct __inplace_merge_switch { - static const unsigned value = has_trivial_copy_assign<_Tp>::value; + static const unsigned value = is_trivially_copy_assignable<_Tp>::value; }; template @@ -4237,7 +4237,7 @@ __stable_sort_move(_RandomAccessIterator __first1, _RandomAccessIterator __last1 template struct __stable_sort_switch { - static const unsigned value = 128*has_trivial_copy_assign<_Tp>::value; + static const unsigned value = 128*is_trivially_copy_assignable<_Tp>::value; }; template diff --git a/include/iterator b/include/iterator index 0ad489b96..6fcb259f9 100644 --- a/include/iterator +++ b/include/iterator @@ -1038,7 +1038,7 @@ template _B2 move_backward(_B1, _B1, _B2); template typename enable_if < - has_trivial_copy_assign<_Tp>::value, + is_trivially_copy_assignable<_Tp>::value, _Tp* >::type __unwrap_iter(__wrap_iter<_Tp*>); @@ -1137,7 +1137,7 @@ private: friend typename enable_if < - has_trivial_copy_assign<_Tp>::value, + is_trivially_copy_assignable<_Tp>::value, _Tp* >::type __unwrap_iter(__wrap_iter<_Tp*>); diff --git a/include/memory b/include/memory index ba00f52e6..c20e1a0c6 100644 --- a/include/memory +++ b/include/memory @@ -2446,15 +2446,15 @@ public: template _LIBCPP_INLINE_VISIBILITY void __incr(_Tp*) - {__incr(integral_constant::value>());} + {__incr(integral_constant::value>());} template _LIBCPP_INLINE_VISIBILITY void __set(size_t __s, _Tp*) - {__set(__s, integral_constant::value>());} + {__set(__s, integral_constant::value>());} template _LIBCPP_INLINE_VISIBILITY void operator()(_Tp* __p) - {__process(__p, integral_constant::value>());} + {__process(__p, integral_constant::value>());} }; template diff --git a/include/type_traits b/include/type_traits index 7514330c1..6b8a99ff4 100644 --- a/include/type_traits +++ b/include/type_traits @@ -92,29 +92,32 @@ namespace std template struct is_abstract; template struct is_constructible; + template struct is_default_constructible; + template struct is_copy_constructible; + template struct is_move_constructible; + template struct is_assignable; + template struct is_copy_assignable; + template struct is_move_assignable; + template struct is_destructible; + + template struct is_trivially_constructible; + template struct is_trivially_default_constructible; + template struct is_trivially_copy_constructible; + template struct is_trivially_move_constructible; + template struct is_trivially_assignable; + template struct is_trivially_copy_assignable; + template struct is_trivially_move_assignable; + template struct is_trivially_destructible; + template struct is_nothrow_constructible; + template struct is_nothrow_default_constructible; + template struct is_nothrow_copy_constructible; + template struct is_nothrow_move_constructible; + template struct is_nothrow_assignable; + template struct is_nothrow_copy_assignable; + template struct is_nothrow_move_assignable; + template struct is_nothrow_destructible; - template struct has_trivial_default_constructor - template struct has_nothrow_default_constructor; - template struct has_default_constructor; - - template struct has_trivial_copy_constructor; - template struct has_nothrow_copy_constructor; - template struct has_copy_constructor; - - template struct has_trivial_move_constructor; - template struct has_nothrow_move_constructor; - template struct has_move_constructor; - - template struct has_trivial_copy_assign; - template struct has_nothrow_copy_assign; - template struct has_copy_assign; - - template struct has_trivial_move_assign; - template struct has_nothrow_move_assign; - template struct has_move_assign; - - template struct has_trivial_destructor; template struct has_virtual_destructor; // Relationships between types: @@ -777,118 +780,6 @@ template struct __libcpp_polymorphic<_Tp, false> : public false_type template struct _LIBCPP_VISIBLE is_polymorphic : public __libcpp_polymorphic<_Tp> {}; -// has_trivial_default_constructor - -#ifdef _LIBCPP_HAS_TYPE_TRAITS - -template struct _LIBCPP_VISIBLE has_trivial_default_constructor - : public integral_constant {}; - -#else // _LIBCPP_HAS_TYPE_TRAITS - -template struct __has_trivial_default_constructor - : public integral_constant::value> {}; - -template struct _LIBCPP_VISIBLE has_trivial_default_constructor - : public __has_trivial_default_constructor::type> {}; - -#endif // _LIBCPP_HAS_TYPE_TRAITS - -// has_nothrow_default_constructor - -#ifdef _LIBCPP_HAS_TYPE_TRAITS - -template struct _LIBCPP_VISIBLE has_nothrow_default_constructor - : public integral_constant {}; - -#else // _LIBCPP_HAS_TYPE_TRAITS - -template struct _LIBCPP_VISIBLE has_nothrow_default_constructor - : public has_trivial_default_constructor<_Tp> {}; - -#endif // _LIBCPP_HAS_TYPE_TRAITS - -// has_trivial_copy_constructor - -#ifdef _LIBCPP_HAS_TYPE_TRAITS - -template struct _LIBCPP_VISIBLE has_trivial_copy_constructor - : public integral_constant {}; - -#else // _LIBCPP_HAS_TYPE_TRAITS - -template struct _LIBCPP_VISIBLE has_trivial_copy_constructor - : public integral_constant::value || - is_reference<_Tp>::value> {}; - -#endif // _LIBCPP_HAS_TYPE_TRAITS - -// has_nothrow_copy_constructor - -#ifdef _LIBCPP_HAS_TYPE_TRAITS - -template struct _LIBCPP_VISIBLE has_nothrow_copy_constructor - : public integral_constant {}; - -#else // _LIBCPP_HAS_TYPE_TRAITS - -template struct _LIBCPP_VISIBLE has_nothrow_copy_constructor - : public has_trivial_copy_constructor<_Tp> {}; - -#endif // _LIBCPP_HAS_TYPE_TRAITS - -// has_nothrow_move_constructor - -template struct _LIBCPP_VISIBLE has_nothrow_move_constructor - : public has_nothrow_copy_constructor<_Tp> {}; - -// has_trivial_copy_assign - -#ifdef _LIBCPP_HAS_TYPE_TRAITS - -template struct _LIBCPP_VISIBLE has_trivial_copy_assign - : public integral_constant {}; - -#else // _LIBCPP_HAS_TYPE_TRAITS - -template struct _LIBCPP_VISIBLE has_trivial_copy_assign - : public integral_constant::value && - !is_const<_Tp>::value> {}; - -#endif // _LIBCPP_HAS_TYPE_TRAITS - -// has_nothrow_copy_assign - -#ifdef _LIBCPP_HAS_TYPE_TRAITS - -template struct _LIBCPP_VISIBLE has_nothrow_copy_assign - : public integral_constant {}; - -#else // _LIBCPP_HAS_TYPE_TRAITS - -template struct _LIBCPP_VISIBLE has_nothrow_copy_assign - : public has_trivial_copy_assign<_Tp> {}; - -#endif // _LIBCPP_HAS_TYPE_TRAITS - -// has_trivial_destructor - -#ifdef _LIBCPP_HAS_TYPE_TRAITS - -template struct _LIBCPP_VISIBLE has_trivial_destructor - : public integral_constant {}; - -#else // _LIBCPP_HAS_TYPE_TRAITS - -template struct __libcpp_trivial_destructor - : public integral_constant::value || - is_reference<_Tp>::value> {}; - -template struct _LIBCPP_VISIBLE has_trivial_destructor - : public __libcpp_trivial_destructor::type> {}; - -#endif // _LIBCPP_HAS_TYPE_TRAITS - // has_virtual_destructor #ifdef _LIBCPP_HAS_TYPE_TRAITS @@ -903,23 +794,6 @@ template struct _LIBCPP_VISIBLE has_virtual_destructor #endif // _LIBCPP_HAS_TYPE_TRAITS -// is_pod - -#ifdef _LIBCPP_HAS_TYPE_TRAITS - -template struct _LIBCPP_VISIBLE is_pod - : public integral_constant {}; - -#else // _LIBCPP_HAS_TYPE_TRAITS - -template struct _LIBCPP_VISIBLE is_pod - : public integral_constant::value && - has_trivial_copy_constructor<_Tp>::value && - has_trivial_copy_assign<_Tp>::value && - has_trivial_destructor<_Tp>::value> {}; - -#endif // _LIBCPP_HAS_TYPE_TRAITS - // alignment_of template struct __alignment_of {_Tp _;}; @@ -1287,6 +1161,8 @@ struct _LIBCPP_VISIBLE common_type<_Tp, _Up, _Vp...> #endif // _LIBCPP_HAS_NO_VARIADICS +// is_assignable + template decltype((_STD::declval<_Tp>() = _STD::declval<_Arg>(), true_type())) #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -1311,19 +1187,56 @@ struct __is_assignable_imp >::type {}; template -struct __is_assignable +struct is_assignable : public __is_assignable_imp<_Tp, _Arg> {}; -// has_copy_assign +// is_copy_assignable -template struct _LIBCPP_VISIBLE has_copy_assign - : public __is_assignable<_Tp&, const _Tp&> {}; +template struct _LIBCPP_VISIBLE is_copy_assignable + : public is_assignable<_Tp&, const _Tp&> {}; -template struct _LIBCPP_VISIBLE has_copy_assign<_Tp[]> +// is_move_assignable + +template struct _LIBCPP_VISIBLE is_move_assignable +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + : public is_assignable<_Tp&, _Tp&&> {}; +#else + : public is_copy_assignable<_Tp> {}; +#endif + +// is_destructible + +template +struct __destructible_test +{ + _Tp __t; +}; + +template +decltype((_STD::declval<__destructible_test<_Tp> >().~__destructible_test<_Tp>(), true_type())) +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +__is_destructible_test(_Tp&&); +#else +__is_destructible_test(_Tp&); +#endif + +false_type +__is_destructible_test(__any); + +template ::value || is_abstract<_Tp>::value> +struct __destructible_imp + : public common_type + < + decltype(__is_destructible_test(declval<_Tp>())) + >::type {}; + +template +struct __destructible_imp<_Tp, true> : public false_type {}; -template struct _LIBCPP_VISIBLE has_copy_assign<_Tp&> - : public false_type {}; +template +struct is_destructible + : public __destructible_imp<_Tp> {}; // move @@ -1638,7 +1551,7 @@ class _LIBCPP_VISIBLE result_of<_Fn(_A0, _A1, _A2)> #endif // _LIBCPP_HAS_NO_VARIADICS -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#ifndef _LIBCPP_HAS_NO_VARIADICS // template struct is_constructible; @@ -1758,24 +1671,35 @@ struct __is_constructible : public false_type {}; -template -struct _LIBCPP_VISIBLE has_default_constructor - : public is_constructible<_Tp> - {}; - -#else // _LIBCPP_HAS_NO_ADVANCED_SFINAE +#else // _LIBCPP_HAS_NO_VARIADICS // template struct is_constructible0; // main is_constructible0 test template -decltype((_STD::move(_Tp()), true_type())) +decltype((_Tp(), true_type())) __is_constructible0_test(_Tp&); false_type __is_constructible0_test(__any); +template +decltype((_Tp(_STD::declval<_A0>()), true_type())) +__is_constructible1_test(_Tp&, _A0&); + +template +false_type +__is_constructible1_test(__any, _A0&); + +template +decltype((_Tp(_STD::declval<_A0>(), _STD::declval<_A1>()), true_type())) +__is_constructible2_test(_Tp&, _A0&, _A1&); + +template +false_type +__is_constructible2_test(__any, _A0&, _A1&); + template struct __is_constructible0_imp // false, _Tp is not a scalar : public common_type @@ -1784,6 +1708,22 @@ struct __is_constructible0_imp // false, _Tp is not a scalar >::type {}; +template +struct __is_constructible1_imp // false, _Tp is not a scalar + : public common_type + < + decltype(__is_constructible1_test(declval<_Tp&>(), declval<_A0&>())) + >::type + {}; + +template +struct __is_constructible2_imp // false, _Tp is not a scalar + : public common_type + < + decltype(__is_constructible2_test(declval<_Tp&>(), declval<_A0>(), declval<_A1>())) + >::type + {}; + // handle scalars and reference types // Scalars are default constructible, references are not @@ -1793,6 +1733,16 @@ struct __is_constructible0_imp : public is_scalar<_Tp> {}; +template +struct __is_constructible1_imp + : public is_convertible<_A0, _Tp> + {}; + +template +struct __is_constructible2_imp + : public false_type + {}; + // Treat scalars and reference types separately template @@ -1801,6 +1751,18 @@ struct __is_constructible0_void_check _Tp> {}; +template +struct __is_constructible1_void_check + : public __is_constructible1_imp::value || is_reference<_Tp>::value, + _Tp, _A0> + {}; + +template +struct __is_constructible2_void_check + : public __is_constructible2_imp::value || is_reference<_Tp>::value, + _Tp, _A0, _A1> + {}; + // If any of T or Args is void, is_constructible should be false template @@ -1808,21 +1770,69 @@ struct __is_constructible0_void_check : public false_type {}; -// has_default_constructor entry point +template +struct __is_constructible1_void_check + : public false_type + {}; + +template +struct __is_constructible2_void_check + : public false_type + {}; + +// is_constructible entry point + +namespace __is_construct +{ + +struct __nat {}; + +} + +template +struct _LIBCPP_VISIBLE is_constructible + : public __is_constructible2_void_check::value + || is_abstract<_Tp>::value + || is_function<_Tp>::value + || is_void<_A0>::value + || is_void<_A1>::value, + _Tp, _A0, _A1> + {}; template -struct _LIBCPP_VISIBLE has_default_constructor +struct _LIBCPP_VISIBLE is_constructible<_Tp, __is_construct::__nat, __is_construct::__nat> : public __is_constructible0_void_check::value - || is_abstract<_Tp>::value, + || is_abstract<_Tp>::value + || is_function<_Tp>::value, _Tp> {}; +template +struct _LIBCPP_VISIBLE is_constructible<_Tp, _A0, __is_construct::__nat> + : public __is_constructible1_void_check::value + || is_abstract<_Tp>::value + || is_function<_Tp>::value + || is_void<_A0>::value, + _Tp, _A0> + {}; + // Array types are default constructible if their element type // is default constructible template struct __is_constructible0_imp - : public has_default_constructor::type> + : public is_constructible::type> + {}; + +template +struct __is_constructible1_imp + : public false_type + {}; + +template +struct __is_constructible2_imp + : public false_type {}; // Incomplete array types are not constructible @@ -1832,25 +1842,468 @@ struct __is_constructible0_imp : public false_type {}; -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE - -// has_copy_constructor - -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE - -template -struct _LIBCPP_VISIBLE has_copy_constructor - : public is_constructible<_Tp, typename add_lvalue_reference::type> +template +struct __is_constructible1_imp + : public false_type {}; -#else // _LIBCPP_HAS_NO_ADVANCED_SFINAE - -template -struct _LIBCPP_VISIBLE has_copy_constructor - : public has_nothrow_copy_constructor<_Tp> +template +struct __is_constructible2_imp + : public false_type {}; -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE +#endif // _LIBCPP_HAS_NO_VARIADICS + +// is_default_constructible + +template +struct _LIBCPP_VISIBLE is_default_constructible + : public is_constructible<_Tp> + {}; + +// is_copy_constructible + +template +struct _LIBCPP_VISIBLE is_copy_constructible + : public is_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type> + {}; + +// is_move_constructible + +template +struct _LIBCPP_VISIBLE is_move_constructible +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> +#else + : public is_copy_constructible<_Tp> +#endif + {}; + +// is_trivially_constructible + +#ifndef _LIBCPP_HAS_NO_VARIADICS + +template +struct _LIBCPP_VISIBLE is_trivially_constructible + : false_type +{ +}; + +template +struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp> +#ifdef _LIBCPP_HAS_TYPE_TRAITS + : integral_constant +#else + : integral_constant::value> +#endif +{ +}; + +template +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&&> +#else +struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp> +#endif +#ifdef _LIBCPP_HAS_TYPE_TRAITS + : integral_constant +#else + : integral_constant::value> +#endif +{ +}; + +template +struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&> +#ifdef _LIBCPP_HAS_TYPE_TRAITS + : integral_constant +#else + : integral_constant::value> +#endif +{ +}; + +template +struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&> +#ifdef _LIBCPP_HAS_TYPE_TRAITS + : integral_constant +#else + : integral_constant::value> +#endif +{ +}; + +#else // _LIBCPP_HAS_NO_VARIADICS + +template +struct _LIBCPP_VISIBLE is_trivially_constructible + : false_type +{ +}; + +template +struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, __is_construct::__nat, + __is_construct::__nat> +#ifdef _LIBCPP_HAS_TYPE_TRAITS + : integral_constant +#else + : integral_constant::value> +#endif +{ +}; + +template +struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp, + __is_construct::__nat> +#ifdef _LIBCPP_HAS_TYPE_TRAITS + : integral_constant +#else + : integral_constant::value> +#endif +{ +}; + +template +struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&, + __is_construct::__nat> +#ifdef _LIBCPP_HAS_TYPE_TRAITS + : integral_constant +#else + : integral_constant::value> +#endif +{ +}; + +template +struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&, + __is_construct::__nat> +#ifdef _LIBCPP_HAS_TYPE_TRAITS + : integral_constant +#else + : integral_constant::value> +#endif +{ +}; + +#endif // _LIBCPP_HAS_NO_VARIADICS + +// is_trivially_default_constructible + +template struct _LIBCPP_VISIBLE is_trivially_default_constructible + : public is_trivially_constructible<_Tp> + {}; + +// is_trivially_copy_constructible + +template struct _LIBCPP_VISIBLE is_trivially_copy_constructible + : public is_trivially_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type> + {}; + +// is_trivially_move_constructible + +template struct _LIBCPP_VISIBLE is_trivially_move_constructible +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> +#else + : public is_trivially_copy_constructible<_Tp> +#endif + {}; + +// is_trivially_assignable + +template +struct is_trivially_assignable + : public false_type {}; + +template +struct is_trivially_assignable<_Tp&, _Tp> +#ifdef _LIBCPP_HAS_TYPE_TRAITS + : integral_constant {}; +#else + : integral_constant::value> {}; +#endif + +template +struct is_trivially_assignable<_Tp&, _Tp&> +#ifdef _LIBCPP_HAS_TYPE_TRAITS + : integral_constant {}; +#else + : integral_constant::value> {}; +#endif + +template +struct is_trivially_assignable<_Tp&, const _Tp&> +#ifdef _LIBCPP_HAS_TYPE_TRAITS + : integral_constant {}; +#else + : integral_constant::value> {}; +#endif + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + +template +struct is_trivially_assignable<_Tp&, _Tp&&> +#ifdef _LIBCPP_HAS_TYPE_TRAITS + : integral_constant {}; +#else + : integral_constant::value> {}; +#endif + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +// is_trivially_copy_assignable + +template struct _LIBCPP_VISIBLE is_trivially_copy_assignable + : public is_trivially_assignable::type, + const typename add_lvalue_reference<_Tp>::type> + {}; + +// is_trivially_move_assignable + +template struct _LIBCPP_VISIBLE is_trivially_move_assignable + : public is_trivially_assignable::type, +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + typename add_rvalue_reference<_Tp>::type> +#else + typename add_lvalue_reference<_Tp>::type> +#endif + {}; + +// is_trivially_destructible + +#ifdef _LIBCPP_HAS_TYPE_TRAITS + +template struct _LIBCPP_VISIBLE is_trivially_destructible + : public integral_constant {}; + +#else // _LIBCPP_HAS_TYPE_TRAITS + +template struct __libcpp_trivial_destructor + : public integral_constant::value || + is_reference<_Tp>::value> {}; + +template struct _LIBCPP_VISIBLE is_trivially_destructible + : public __libcpp_trivial_destructor::type> {}; + +#endif // _LIBCPP_HAS_TYPE_TRAITS + +// is_nothrow_constructible + +#ifndef _LIBCPP_HAS_NO_VARIADICS + +template +struct _LIBCPP_VISIBLE is_nothrow_constructible + : false_type +{ +}; + +template +struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp> +#ifdef _LIBCPP_HAS_TYPE_TRAITS + : integral_constant +#else + : integral_constant::value> +#endif +{ +}; + +template +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp&&> +#else +struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp> +#endif +#ifdef _LIBCPP_HAS_TYPE_TRAITS + : integral_constant +#else + : integral_constant::value> +#endif +{ +}; + +template +struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, const _Tp&> +#ifdef _LIBCPP_HAS_TYPE_TRAITS + : integral_constant +#else + : integral_constant::value> +#endif +{ +}; + +template +struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp&> +#ifdef _LIBCPP_HAS_TYPE_TRAITS + : integral_constant +#else + : integral_constant::value> +#endif +{ +}; + +#else // _LIBCPP_HAS_NO_VARIADICS + +template +struct _LIBCPP_VISIBLE is_nothrow_constructible + : false_type +{ +}; + +template +struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, __is_construct::__nat, + __is_construct::__nat> +#ifdef _LIBCPP_HAS_TYPE_TRAITS + : integral_constant +#else + : integral_constant::value> +#endif +{ +}; + +template +struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp, + __is_construct::__nat> +#ifdef _LIBCPP_HAS_TYPE_TRAITS + : integral_constant +#else + : integral_constant::value> +#endif +{ +}; + +template +struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, const _Tp&, + __is_construct::__nat> +#ifdef _LIBCPP_HAS_TYPE_TRAITS + : integral_constant +#else + : integral_constant::value> +#endif +{ +}; + +template +struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp&, + __is_construct::__nat> +#ifdef _LIBCPP_HAS_TYPE_TRAITS + : integral_constant +#else + : integral_constant::value> +#endif +{ +}; + +#endif // _LIBCPP_HAS_NO_VARIADICS + +// is_nothrow_default_constructible + +template struct _LIBCPP_VISIBLE is_nothrow_default_constructible + : public is_nothrow_constructible<_Tp> + {}; + +// is_nothrow_copy_constructible + +template struct _LIBCPP_VISIBLE is_nothrow_copy_constructible + : public is_nothrow_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type> + {}; + +// is_nothrow_move_constructible + +template struct _LIBCPP_VISIBLE is_nothrow_move_constructible +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> +#else + : public is_nothrow_copy_constructible<_Tp> +#endif + {}; + +// is_nothrow_assignable + +template +struct is_nothrow_assignable + : public false_type {}; + +template +struct is_nothrow_assignable<_Tp&, _Tp> +#ifdef _LIBCPP_HAS_TYPE_TRAITS + : integral_constant {}; +#else + : integral_constant::value> {}; +#endif + +template +struct is_nothrow_assignable<_Tp&, _Tp&> +#ifdef _LIBCPP_HAS_TYPE_TRAITS + : integral_constant {}; +#else + : integral_constant::value> {}; +#endif + +template +struct is_nothrow_assignable<_Tp&, const _Tp&> +#ifdef _LIBCPP_HAS_TYPE_TRAITS + : integral_constant {}; +#else + : integral_constant::value> {}; +#endif + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + +template +struct is_nothrow_assignable<_Tp&, _Tp&&> +#ifdef _LIBCPP_HAS_TYPE_TRAITS + : integral_constant {}; +#else + : integral_constant::value> {}; +#endif + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +// is_nothrow_copy_assignable + +template struct _LIBCPP_VISIBLE is_nothrow_copy_assignable + : public is_nothrow_assignable::type, + const typename add_lvalue_reference<_Tp>::type> + {}; + +// is_nothrow_move_assignable + +template struct _LIBCPP_VISIBLE is_nothrow_move_assignable + : public is_nothrow_assignable::type, +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + typename add_rvalue_reference<_Tp>::type> +#else + typename add_lvalue_reference<_Tp>::type> +#endif + {}; + +// is_nothrow_destructible + +template struct __libcpp_nothrow_destructor + : public integral_constant::value || + is_reference<_Tp>::value> {}; + +template struct _LIBCPP_VISIBLE is_nothrow_destructible + : public __libcpp_nothrow_destructor::type> {}; + +// is_pod + +#ifdef _LIBCPP_HAS_TYPE_TRAITS + +template struct _LIBCPP_VISIBLE is_pod + : public integral_constant {}; + +#else // _LIBCPP_HAS_TYPE_TRAITS + +template struct _LIBCPP_VISIBLE is_pod + : public integral_constant::value && + is_trivially_copy_constructible<_Tp>::value && + is_trivially_copy_assignable<_Tp>::value && + is_trivially_destructible<_Tp>::value> {}; + +#endif // _LIBCPP_HAS_TYPE_TRAITS template struct __is_zero_default_constructible : public integral_constant::value || is_empty<_Tp>::value> {}; diff --git a/include/utility b/include/utility index f4c94bea9..f8a8fc529 100644 --- a/include/utility +++ b/include/utility @@ -38,7 +38,7 @@ template typename remove_reference::type&& move(T&&); template typename conditional < - !has_nothrow_move_constructor::value && has_copy_constructor::value, + !is_nothrow_move_constructible::value && is_copy_constructible::value, const T&, T&& >::type @@ -178,7 +178,7 @@ inline _LIBCPP_INLINE_VISIBILITY #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES typename conditional < - !has_nothrow_move_constructor<_Tp>::value && has_copy_constructor<_Tp>::value, + !is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value, const _Tp&, _Tp&& >::type diff --git a/include/vector b/include/vector index 80b1ceffc..074e44546 100644 --- a/include/vector +++ b/include/vector @@ -326,7 +326,7 @@ protected: _LIBCPP_INLINE_VISIBILITY size_type capacity() const {return static_cast(__end_cap() - __begin_);} _LIBCPP_INLINE_VISIBILITY void __destruct_at_end(const_pointer __new_last) - {__destruct_at_end(__new_last, has_trivial_destructor());} + {__destruct_at_end(__new_last, is_trivially_destructible());} void __destruct_at_end(const_pointer __new_last, false_type); void __destruct_at_end(const_pointer __new_last, true_type); @@ -771,8 +771,8 @@ _LIBCPP_INLINE_VISIBILITY inline void vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x) { - __construct_at_end(__n, __x, integral_constant::value && - has_trivial_copy_assign::value>()); + __construct_at_end(__n, __x, integral_constant::value && + is_trivially_copy_assignable::value>()); } template diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/has_copy_assign.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/has_copy_assign.pass.cpp deleted file mode 100644 index c65037222..000000000 --- a/test/utilities/meta/meta.unary/meta.unary.prop/has_copy_assign.pass.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_copy_assign - -#include - -class Empty -{ -}; - -class NotEmpty -{ -public: - virtual ~NotEmpty(); -}; - -union Union {}; - -struct bit_zero -{ - int : 0; -}; - -struct A -{ - A(); -}; - -int main() -{ - static_assert(( std::has_copy_assign::value), ""); - static_assert((!std::has_copy_assign::value), ""); - static_assert((!std::has_copy_assign::value), ""); - static_assert((!std::has_copy_assign::value), ""); - static_assert((!std::has_copy_assign::value), ""); - static_assert(( std::has_copy_assign::value), ""); - static_assert(( std::has_copy_assign::value), ""); - static_assert(( std::has_copy_assign::value), ""); - static_assert(( std::has_copy_assign::value), ""); - static_assert(( std::has_copy_assign::value), ""); -} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/has_copy_constructor.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/has_copy_constructor.pass.cpp deleted file mode 100644 index 8d7461349..000000000 --- a/test/utilities/meta/meta.unary/meta.unary.prop/has_copy_constructor.pass.cpp +++ /dev/null @@ -1,67 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_copy_constructor - -#include - -template -void test_has_copy_constructor() -{ - static_assert(std::has_copy_constructor::value == Result, ""); -} - -class Empty -{ -}; - -class NotEmpty -{ -public: - virtual ~NotEmpty(); -}; - -union Union {}; - -struct bit_zero -{ - int : 0; -}; - -class Abstract -{ -public: - virtual ~Abstract() = 0; -}; - -struct A -{ - A(const A&); -}; - -int main() -{ - test_has_copy_constructor(); - test_has_copy_constructor(); - test_has_copy_constructor(); - test_has_copy_constructor(); - - test_has_copy_constructor(); - test_has_copy_constructor(); - test_has_copy_constructor(); - test_has_copy_constructor(); - test_has_copy_constructor(); - test_has_copy_constructor(); - test_has_copy_constructor(); - test_has_copy_constructor(); - test_has_copy_constructor(); - test_has_copy_constructor(); -} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/has_default_constructor.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/has_default_constructor.pass.cpp deleted file mode 100644 index 7a4c98b39..000000000 --- a/test/utilities/meta/meta.unary/meta.unary.prop/has_default_constructor.pass.cpp +++ /dev/null @@ -1,70 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_default_constructor - -#include - -template -void test_has_default_constructor() -{ - static_assert(std::has_default_constructor::value == Result, ""); - static_assert(std::has_default_constructor::value == Result, ""); - static_assert(std::has_default_constructor::value == Result, ""); - static_assert(std::has_default_constructor::value == Result, ""); -} - -class Empty -{ -}; - -class NotEmpty -{ -public: - virtual ~NotEmpty(); -}; - -union Union {}; - -struct bit_zero -{ - int : 0; -}; - -class Abstract -{ -public: - virtual ~Abstract() = 0; -}; - -struct A -{ - A(); -}; - -int main() -{ - test_has_default_constructor(); - test_has_default_constructor(); - test_has_default_constructor(); - test_has_default_constructor(); - - test_has_default_constructor(); - test_has_default_constructor(); - test_has_default_constructor(); - test_has_default_constructor(); - test_has_default_constructor(); - test_has_default_constructor(); - test_has_default_constructor(); - test_has_default_constructor(); - test_has_default_constructor(); - test_has_default_constructor(); -} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/has_move_assign.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/has_move_assign.pass.cpp deleted file mode 100644 index 135a0ed79..000000000 --- a/test/utilities/meta/meta.unary/meta.unary.prop/has_move_assign.pass.cpp +++ /dev/null @@ -1,19 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_move_assign - -#include - -int main() -{ -#error has_move_assign not implemented -} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/has_move_constructor.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/has_move_constructor.pass.cpp deleted file mode 100644 index 0f1161e0d..000000000 --- a/test/utilities/meta/meta.unary/meta.unary.prop/has_move_constructor.pass.cpp +++ /dev/null @@ -1,19 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_move_constructor - -#include - -int main() -{ -#error has_move_constructor not implemented -} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_constructor.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_constructor.pass.cpp deleted file mode 100644 index 536008725..000000000 --- a/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_constructor.pass.cpp +++ /dev/null @@ -1,79 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_nothrow_copy_constructor - -#include - -template -void test_has_nothrow_copy_constructor() -{ - static_assert( std::has_nothrow_copy_constructor::value, ""); - static_assert( std::has_nothrow_copy_constructor::value, ""); - static_assert( std::has_nothrow_copy_constructor::value, ""); - static_assert( std::has_nothrow_copy_constructor::value, ""); -} - -template -void test_has_not_nothrow_copy_constructor() -{ - static_assert(!std::has_nothrow_copy_constructor::value, ""); - static_assert(!std::has_nothrow_copy_constructor::value, ""); - static_assert(!std::has_nothrow_copy_constructor::value, ""); - static_assert(!std::has_nothrow_copy_constructor::value, ""); -} - -class Empty -{ -}; - -class NotEmpty -{ -public: - virtual ~NotEmpty(); -}; - -union Union {}; - -struct bit_zero -{ - int : 0; -}; - -class Abstract -{ -public: - virtual ~Abstract() = 0; -}; - -struct A -{ - A(const A&); -}; - -int main() -{ - test_has_not_nothrow_copy_constructor(); - test_has_not_nothrow_copy_constructor(); - test_has_not_nothrow_copy_constructor(); - test_has_not_nothrow_copy_constructor(); - test_has_not_nothrow_copy_constructor(); - - test_has_nothrow_copy_constructor(); - test_has_nothrow_copy_constructor(); - test_has_nothrow_copy_constructor(); - test_has_nothrow_copy_constructor(); - test_has_nothrow_copy_constructor(); - test_has_nothrow_copy_constructor(); - test_has_nothrow_copy_constructor(); - test_has_nothrow_copy_constructor(); - test_has_nothrow_copy_constructor(); -} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_default_constructor.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_default_constructor.pass.cpp deleted file mode 100644 index 071578392..000000000 --- a/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_default_constructor.pass.cpp +++ /dev/null @@ -1,79 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_nothrow_default_constructor - -#include - -template -void test_has_nothrow_default_constructor() -{ - static_assert( std::has_nothrow_default_constructor::value, ""); - static_assert( std::has_nothrow_default_constructor::value, ""); - static_assert( std::has_nothrow_default_constructor::value, ""); - static_assert( std::has_nothrow_default_constructor::value, ""); -} - -template -void test_has_not_nothrow_default_constructor() -{ - static_assert(!std::has_nothrow_default_constructor::value, ""); - static_assert(!std::has_nothrow_default_constructor::value, ""); - static_assert(!std::has_nothrow_default_constructor::value, ""); - static_assert(!std::has_nothrow_default_constructor::value, ""); -} - -class Empty -{ -}; - -class NotEmpty -{ -public: - virtual ~NotEmpty(); -}; - -union Union {}; - -struct bit_zero -{ - int : 0; -}; - -class Abstract -{ -public: - virtual ~Abstract() = 0; -}; - -struct A -{ - A(); -}; - -int main() -{ - test_has_not_nothrow_default_constructor(); - test_has_not_nothrow_default_constructor(); - test_has_not_nothrow_default_constructor(); - test_has_not_nothrow_default_constructor(); - test_has_not_nothrow_default_constructor(); - - test_has_nothrow_default_constructor(); - test_has_nothrow_default_constructor(); - test_has_nothrow_default_constructor(); - test_has_nothrow_default_constructor(); - test_has_nothrow_default_constructor(); - test_has_nothrow_default_constructor(); - test_has_nothrow_default_constructor(); - test_has_nothrow_default_constructor(); - test_has_nothrow_default_constructor(); -} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_move_assign.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_move_assign.pass.cpp deleted file mode 100644 index bee6a0646..000000000 --- a/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_move_assign.pass.cpp +++ /dev/null @@ -1,19 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_nothrow_move_assign - -#include - -int main() -{ -#error has_nothrow_move_assign not implemented -} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_move_constructor.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_move_constructor.pass.cpp deleted file mode 100644 index 949256ac2..000000000 --- a/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_move_constructor.pass.cpp +++ /dev/null @@ -1,19 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_nothrow_move_constructor - -#include - -int main() -{ -#error has_nothrow_move_constructor not implemented -} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_constructor.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_constructor.pass.cpp deleted file mode 100644 index 684466114..000000000 --- a/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_constructor.pass.cpp +++ /dev/null @@ -1,79 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_trivial_copy_constructor - -#include - -template -void test_has_trivial_copy_constructor() -{ - static_assert( std::has_trivial_copy_constructor::value, ""); - static_assert( std::has_trivial_copy_constructor::value, ""); - static_assert( std::has_trivial_copy_constructor::value, ""); - static_assert( std::has_trivial_copy_constructor::value, ""); -} - -template -void test_has_not_trivial_copy_constructor() -{ - static_assert(!std::has_trivial_copy_constructor::value, ""); - static_assert(!std::has_trivial_copy_constructor::value, ""); - static_assert(!std::has_trivial_copy_constructor::value, ""); - static_assert(!std::has_trivial_copy_constructor::value, ""); -} - -class Empty -{ -}; - -class NotEmpty -{ -public: - virtual ~NotEmpty(); -}; - -union Union {}; - -struct bit_zero -{ - int : 0; -}; - -class Abstract -{ -public: - virtual ~Abstract() = 0; -}; - -struct A -{ - A(const A&); -}; - -int main() -{ - test_has_not_trivial_copy_constructor(); - test_has_not_trivial_copy_constructor(); - test_has_not_trivial_copy_constructor(); - test_has_not_trivial_copy_constructor(); - test_has_not_trivial_copy_constructor(); - test_has_not_trivial_copy_constructor(); - - test_has_trivial_copy_constructor(); - test_has_trivial_copy_constructor(); - test_has_trivial_copy_constructor(); - test_has_trivial_copy_constructor(); - test_has_trivial_copy_constructor(); - test_has_trivial_copy_constructor(); - test_has_trivial_copy_constructor(); - test_has_trivial_copy_constructor(); -} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_default_constructor.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_default_constructor.pass.cpp deleted file mode 100644 index 7dda08e84..000000000 --- a/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_default_constructor.pass.cpp +++ /dev/null @@ -1,77 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_trivial_default_constructor - -#include - -template -void test_has_trivial_default_constructor() -{ - static_assert( std::has_trivial_default_constructor::value, ""); - static_assert( std::has_trivial_default_constructor::value, ""); - static_assert( std::has_trivial_default_constructor::value, ""); - static_assert( std::has_trivial_default_constructor::value, ""); -} - -template -void test_has_not_trivial_default_constructor() -{ - static_assert(!std::has_trivial_default_constructor::value, ""); - static_assert(!std::has_trivial_default_constructor::value, ""); - static_assert(!std::has_trivial_default_constructor::value, ""); - static_assert(!std::has_trivial_default_constructor::value, ""); -} - -class Empty -{ -}; - -class NotEmpty -{ - virtual ~NotEmpty(); -}; - -union Union {}; - -struct bit_zero -{ - int : 0; -}; - -class Abstract -{ - virtual ~Abstract() = 0; -}; - -struct A -{ - A(); -}; - -int main() -{ - test_has_not_trivial_default_constructor(); - test_has_not_trivial_default_constructor(); - test_has_not_trivial_default_constructor(); - test_has_not_trivial_default_constructor(); - test_has_not_trivial_default_constructor(); - test_has_not_trivial_default_constructor(); - - test_has_trivial_default_constructor(); - test_has_trivial_default_constructor(); - test_has_trivial_default_constructor(); - test_has_trivial_default_constructor(); - test_has_trivial_default_constructor(); - test_has_trivial_default_constructor(); - test_has_trivial_default_constructor(); - test_has_trivial_default_constructor(); -} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_destructor.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_destructor.pass.cpp deleted file mode 100644 index cbfc41675..000000000 --- a/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_destructor.pass.cpp +++ /dev/null @@ -1,77 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_trivial_destructor - -#include - -template -void test_has_trivial_destructor() -{ - static_assert( std::has_trivial_destructor::value, ""); - static_assert( std::has_trivial_destructor::value, ""); - static_assert( std::has_trivial_destructor::value, ""); - static_assert( std::has_trivial_destructor::value, ""); -} - -template -void test_has_not_trivial_destructor() -{ - static_assert(!std::has_trivial_destructor::value, ""); - static_assert(!std::has_trivial_destructor::value, ""); - static_assert(!std::has_trivial_destructor::value, ""); - static_assert(!std::has_trivial_destructor::value, ""); -} - -class Empty -{ -}; - -class NotEmpty -{ - virtual ~NotEmpty(); -}; - -union Union {}; - -struct bit_zero -{ - int : 0; -}; - -class Abstract -{ - virtual ~Abstract() = 0; -}; - -struct A -{ - ~A(); -}; - -int main() -{ - test_has_not_trivial_destructor(); - test_has_not_trivial_destructor(); - test_has_not_trivial_destructor(); - test_has_not_trivial_destructor(); - - test_has_trivial_destructor(); - test_has_trivial_destructor(); - test_has_trivial_destructor(); - test_has_trivial_destructor(); - test_has_trivial_destructor(); - test_has_trivial_destructor(); - test_has_trivial_destructor(); - test_has_trivial_destructor(); - test_has_trivial_destructor(); - test_has_trivial_destructor(); -} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_move_assign.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_move_assign.pass.cpp deleted file mode 100644 index 268c1a698..000000000 --- a/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_move_assign.pass.cpp +++ /dev/null @@ -1,19 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_trivial_move_assign - -#include - -int main() -{ -#error has_trivial_move_assign not implemented -} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_move_constructor.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_move_constructor.pass.cpp deleted file mode 100644 index 5a47b14f8..000000000 --- a/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_move_constructor.pass.cpp +++ /dev/null @@ -1,19 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// has_trivial_move_constructor - -#include - -int main() -{ -#error has_trivial_move_constructor not implemented -} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp new file mode 100644 index 000000000..d836e6ac7 --- /dev/null +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_assignable + +#include + +struct A +{ +}; + +struct B +{ + void operator=(A); +}; + +int main() +{ + static_assert(( std::is_assignable::value), ""); + static_assert(( std::is_assignable::value), ""); + static_assert((!std::is_assignable::value), ""); + static_assert((!std::is_assignable::value), ""); + static_assert(( std::is_assignable::value), ""); + static_assert(( std::is_assignable::value), ""); + static_assert((!std::is_assignable::value), ""); +} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp index 00b247b22..40b15c4ea 100644 --- a/test/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp @@ -14,25 +14,17 @@ #include -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE - struct A { explicit A(int); A(int, double); }; -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE - int main() { -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE - static_assert((std::is_constructible::value), ""); static_assert((std::is_constructible::value), ""); static_assert((std::is_constructible::value), ""); static_assert((std::is_constructible::value), ""); static_assert((!std::is_constructible::value), ""); - -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE } diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp new file mode 100644 index 000000000..c44ba6d04 --- /dev/null +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp @@ -0,0 +1,50 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_copy_assignable + +#include + +class Empty +{ +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +struct A +{ + A(); +}; + +int main() +{ + static_assert(( std::is_copy_assignable::value), ""); + static_assert((!std::is_copy_assignable::value), ""); + static_assert((!std::is_copy_assignable::value), ""); + static_assert((!std::is_copy_assignable::value), ""); + static_assert(( std::is_copy_assignable::value), ""); + static_assert(( std::is_copy_assignable::value), ""); + static_assert(( std::is_copy_assignable::value), ""); + static_assert(( std::is_copy_assignable::value), ""); + static_assert(( std::is_copy_assignable::value), ""); + static_assert(( std::is_copy_assignable::value), ""); +} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_copy_constructible.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_copy_constructible.pass.cpp new file mode 100644 index 000000000..691ac6930 --- /dev/null +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_copy_constructible.pass.cpp @@ -0,0 +1,67 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_copy_constructible + +#include + +template +void test_is_copy_constructible() +{ + static_assert(std::is_copy_constructible::value == Result, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ +public: + virtual ~Abstract() = 0; +}; + +struct A +{ + A(const A&); +}; + +int main() +{ + test_is_copy_constructible(); + test_is_copy_constructible(); + test_is_copy_constructible(); + test_is_copy_constructible(); + + test_is_copy_constructible(); + test_is_copy_constructible(); + test_is_copy_constructible(); + test_is_copy_constructible(); + test_is_copy_constructible(); + test_is_copy_constructible(); + test_is_copy_constructible(); + test_is_copy_constructible(); + test_is_copy_constructible(); + test_is_copy_constructible(); +} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp new file mode 100644 index 000000000..0830ce166 --- /dev/null +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp @@ -0,0 +1,70 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_default_constructible + +#include + +template +void test_is_default_constructible() +{ + static_assert(std::is_default_constructible::value == Result, ""); + static_assert(std::is_default_constructible::value == Result, ""); + static_assert(std::is_default_constructible::value == Result, ""); + static_assert(std::is_default_constructible::value == Result, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ +public: + virtual ~Abstract() = 0; +}; + +struct A +{ + A(); +}; + +int main() +{ + test_is_default_constructible(); + test_is_default_constructible(); + test_is_default_constructible(); + test_is_default_constructible(); + + test_is_default_constructible(); + test_is_default_constructible(); + test_is_default_constructible(); + test_is_default_constructible(); + test_is_default_constructible(); + test_is_default_constructible(); + test_is_default_constructible(); + test_is_default_constructible(); + test_is_default_constructible(); + test_is_default_constructible(); +} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp new file mode 100644 index 000000000..61b04b2ab --- /dev/null +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp @@ -0,0 +1,66 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_destructible + +#include + +template +void test_is_destructible() +{ + static_assert( std::is_destructible::value == Result, ""); + static_assert( std::is_destructible::value == Result, ""); + static_assert( std::is_destructible::value == Result, ""); + static_assert( std::is_destructible::value == Result, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +struct A +{ + ~A(); +}; + +int main() +{ + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); +} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp new file mode 100644 index 000000000..3f44f8ebc --- /dev/null +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp @@ -0,0 +1,50 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_move_assignable + +#include + +class Empty +{ +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +struct A +{ + A(); +}; + +int main() +{ + static_assert(( std::is_move_assignable::value), ""); + static_assert((!std::is_move_assignable::value), ""); + static_assert((!std::is_move_assignable::value), ""); + static_assert((!std::is_move_assignable::value), ""); + static_assert(( std::is_move_assignable::value), ""); + static_assert(( std::is_move_assignable::value), ""); + static_assert(( std::is_move_assignable::value), ""); + static_assert(( std::is_move_assignable::value), ""); + static_assert(( std::is_move_assignable::value), ""); + static_assert(( std::is_move_assignable::value), ""); +} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_move_constructible.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_move_constructible.pass.cpp new file mode 100644 index 000000000..3ad3666a2 --- /dev/null +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_move_constructible.pass.cpp @@ -0,0 +1,73 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_move_constructible + +#include + +template +void test_is_move_constructible() +{ + static_assert(std::is_move_constructible::value == Result, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ +public: + virtual ~Abstract() = 0; +}; + +struct A +{ + A(const A&); +}; + +struct B +{ + B(B&&); +}; + +int main() +{ + test_is_move_constructible(); + test_is_move_constructible(); + test_is_move_constructible(); + test_is_move_constructible(); + + test_is_move_constructible(); + test_is_move_constructible(); + test_is_move_constructible(); + test_is_move_constructible(); + test_is_move_constructible(); + test_is_move_constructible(); + test_is_move_constructible(); + test_is_move_constructible(); + test_is_move_constructible(); + test_is_move_constructible(); + test_is_move_constructible(); +} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_assignable.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_assignable.pass.cpp new file mode 100644 index 000000000..b57115269 --- /dev/null +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_assignable.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_nothrow_assignable + +#include + +struct A +{ +}; + +struct B +{ + void operator=(A); +}; + +int main() +{ + static_assert(( std::is_nothrow_assignable::value), ""); + static_assert(( std::is_nothrow_assignable::value), ""); + static_assert((!std::is_nothrow_assignable::value), ""); + static_assert((!std::is_nothrow_assignable::value), ""); + static_assert(( std::is_nothrow_assignable::value), ""); + static_assert((!std::is_nothrow_assignable::value), ""); + static_assert((!std::is_nothrow_assignable::value), ""); +} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp index 24c9eceaa..3dc73cef1 100644 --- a/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp @@ -14,8 +14,6 @@ #include -#ifndef _LIBCPP_HAS_NO_VARIADICS - class Empty { }; @@ -42,11 +40,11 @@ struct A A(const A&); }; -#endif // _LIBCPP_HAS_NO_VARIADICS - int main() { -#ifndef _LIBCPP_HAS_NO_VARIADICS - static_assert((std::is_nothrow_constructible::value), ""); -#endif + static_assert(( std::is_nothrow_constructible::value), ""); + static_assert(( std::is_nothrow_constructible::value), ""); + static_assert((!std::is_nothrow_constructible::value), ""); + static_assert((!std::is_nothrow_constructible::value), ""); + static_assert((!std::is_nothrow_constructible::value), ""); } diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_assign.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_assignable.pass.cpp similarity index 76% rename from test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_assign.pass.cpp rename to test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_assignable.pass.cpp index f9947b887..b0fe06385 100644 --- a/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_assign.pass.cpp +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_assignable.pass.cpp @@ -9,14 +9,14 @@ // type_traits -// has_nothrow_copy_assign +// is_nothrow_copy_assignable #include template void test_has_nothrow_assign() { - static_assert(std::has_nothrow_copy_assign::value == Result, ""); + static_assert(std::is_nothrow_copy_assignable::value == Result, ""); } class Empty @@ -35,11 +35,6 @@ struct bit_zero int : 0; }; -struct Abstract -{ - virtual ~Abstract() = 0; -}; - struct A { A& operator=(const A&); @@ -49,10 +44,7 @@ int main() { test_has_nothrow_assign(); test_has_nothrow_assign(); - test_has_nothrow_assign(); - test_has_nothrow_assign(); - test_has_nothrow_assign(); - test_has_nothrow_assign(); + test_has_nothrow_assign(); test_has_nothrow_assign(); test_has_nothrow_assign(); diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_constructible.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_constructible.pass.cpp new file mode 100644 index 000000000..6bb510441 --- /dev/null +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_constructible.pass.cpp @@ -0,0 +1,70 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_nothrow_copy_constructible + +#include + +template +void test_is_nothrow_copy_constructible() +{ + static_assert( std::is_nothrow_copy_constructible::value, ""); + static_assert( std::is_nothrow_copy_constructible::value, ""); + static_assert( std::is_nothrow_copy_constructible::value, ""); + static_assert( std::is_nothrow_copy_constructible::value, ""); +} + +template +void test_has_not_nothrow_copy_constructor() +{ + static_assert(!std::is_nothrow_copy_constructible::value, ""); + static_assert(!std::is_nothrow_copy_constructible::value, ""); + static_assert(!std::is_nothrow_copy_constructible::value, ""); + static_assert(!std::is_nothrow_copy_constructible::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +struct A +{ + A(const A&); +}; + +int main() +{ + test_has_not_nothrow_copy_constructor(); + test_has_not_nothrow_copy_constructor(); + + test_is_nothrow_copy_constructible(); + test_is_nothrow_copy_constructible(); + test_is_nothrow_copy_constructible(); + test_is_nothrow_copy_constructible(); + test_is_nothrow_copy_constructible(); + test_is_nothrow_copy_constructible(); + test_is_nothrow_copy_constructible(); + test_is_nothrow_copy_constructible(); + test_is_nothrow_copy_constructible(); +} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_default_constructible.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_default_constructible.pass.cpp new file mode 100644 index 000000000..84fb5f41b --- /dev/null +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_default_constructible.pass.cpp @@ -0,0 +1,71 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_nothrow_default_constructible + +#include + +template +void test_is_nothrow_default_constructible() +{ + static_assert( std::is_nothrow_default_constructible::value, ""); + static_assert( std::is_nothrow_default_constructible::value, ""); + static_assert( std::is_nothrow_default_constructible::value, ""); + static_assert( std::is_nothrow_default_constructible::value, ""); +} + +template +void test_has_not_nothrow_default_constructor() +{ + static_assert(!std::is_nothrow_default_constructible::value, ""); + static_assert(!std::is_nothrow_default_constructible::value, ""); + static_assert(!std::is_nothrow_default_constructible::value, ""); + static_assert(!std::is_nothrow_default_constructible::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +struct A +{ + A(); +}; + +int main() +{ + test_has_not_nothrow_default_constructor(); + test_has_not_nothrow_default_constructor(); + test_has_not_nothrow_default_constructor(); + + test_is_nothrow_default_constructible(); + test_is_nothrow_default_constructible(); + test_is_nothrow_default_constructible(); + test_is_nothrow_default_constructible(); + test_is_nothrow_default_constructible(); + test_is_nothrow_default_constructible(); + test_is_nothrow_default_constructible(); + test_is_nothrow_default_constructible(); + test_is_nothrow_default_constructible(); +} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp new file mode 100644 index 000000000..dfa1b36cf --- /dev/null +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp @@ -0,0 +1,77 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_nothrow_destructible + +#include + +template +void test_is_nothrow_destructible() +{ + static_assert( std::is_nothrow_destructible::value, ""); + static_assert( std::is_nothrow_destructible::value, ""); + static_assert( std::is_nothrow_destructible::value, ""); + static_assert( std::is_nothrow_destructible::value, ""); +} + +template +void test_has_not_nothrow_destructor() +{ + static_assert(!std::is_nothrow_destructible::value, ""); + static_assert(!std::is_nothrow_destructible::value, ""); + static_assert(!std::is_nothrow_destructible::value, ""); + static_assert(!std::is_nothrow_destructible::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +struct A +{ + ~A(); +}; + +int main() +{ + test_has_not_nothrow_destructor(); + test_has_not_nothrow_destructor(); + test_has_not_nothrow_destructor(); + test_has_not_nothrow_destructor(); + + test_is_nothrow_destructible(); + test_is_nothrow_destructible(); + test_is_nothrow_destructible(); + test_is_nothrow_destructible(); + test_is_nothrow_destructible(); + test_is_nothrow_destructible(); + test_is_nothrow_destructible(); + test_is_nothrow_destructible(); + test_is_nothrow_destructible(); + test_is_nothrow_destructible(); +} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_assignable.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_assignable.pass.cpp new file mode 100644 index 000000000..96a4a32b3 --- /dev/null +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_assignable.pass.cpp @@ -0,0 +1,57 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// has_nothrow_move_assign + +#include + +template +void test_has_nothrow_assign() +{ + static_assert(std::is_nothrow_move_assignable::value == Result, ""); +} + +class Empty +{ +}; + +struct NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +struct A +{ + A& operator=(const A&); +}; + +int main() +{ + test_has_nothrow_assign(); + test_has_nothrow_assign(); + test_has_nothrow_assign(); + + test_has_nothrow_assign(); + test_has_nothrow_assign(); + test_has_nothrow_assign(); + test_has_nothrow_assign(); + test_has_nothrow_assign(); + test_has_nothrow_assign(); + test_has_nothrow_assign(); + test_has_nothrow_assign(); +} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_constructible.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_constructible.pass.cpp new file mode 100644 index 000000000..fc5207601 --- /dev/null +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_constructible.pass.cpp @@ -0,0 +1,70 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// has_nothrow_move_constructor + +#include + +template +void test_is_nothrow_move_constructible() +{ + static_assert( std::is_nothrow_move_constructible::value, ""); + static_assert( std::is_nothrow_move_constructible::value, ""); + static_assert( std::is_nothrow_move_constructible::value, ""); + static_assert( std::is_nothrow_move_constructible::value, ""); +} + +template +void test_has_not_nothrow_move_constructor() +{ + static_assert(!std::is_nothrow_move_constructible::value, ""); + static_assert(!std::is_nothrow_move_constructible::value, ""); + static_assert(!std::is_nothrow_move_constructible::value, ""); + static_assert(!std::is_nothrow_move_constructible::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +struct A +{ + A(const A&); +}; + +int main() +{ + test_has_not_nothrow_move_constructor(); + test_has_not_nothrow_move_constructor(); + + test_has_not_nothrow_move_constructor(); + test_is_nothrow_move_constructible(); + test_is_nothrow_move_constructible(); + test_is_nothrow_move_constructible(); + test_is_nothrow_move_constructible(); + test_is_nothrow_move_constructible(); + test_is_nothrow_move_constructible(); + test_is_nothrow_move_constructible(); + test_is_nothrow_move_constructible(); +} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_assignable.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_assignable.pass.cpp new file mode 100644 index 000000000..cd6d5d277 --- /dev/null +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_assignable.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_trivially_assignable + +#include + +struct A +{ +}; + +struct B +{ + void operator=(A); +}; + +int main() +{ + static_assert(( std::is_trivially_assignable::value), ""); + static_assert(( std::is_trivially_assignable::value), ""); + static_assert((!std::is_trivially_assignable::value), ""); + static_assert((!std::is_trivially_assignable::value), ""); + static_assert(( std::is_trivially_assignable::value), ""); + static_assert((!std::is_trivially_assignable::value), ""); + static_assert((!std::is_trivially_assignable::value), ""); +} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_constructible.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_constructible.pass.cpp new file mode 100644 index 000000000..ce0373baf --- /dev/null +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_constructible.pass.cpp @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// template +// struct is_trivially_constructible; + +#include + +struct A +{ + explicit A(int); + A(int, double); +}; + +int main() +{ + static_assert(( std::is_trivially_constructible::value), ""); + static_assert(( std::is_trivially_constructible::value), ""); + static_assert((!std::is_trivially_constructible::value), ""); + static_assert((!std::is_trivially_constructible::value), ""); + static_assert((!std::is_trivially_constructible::value), ""); +} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_assign.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_assignable.pass.cpp similarity index 83% rename from test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_assign.pass.cpp rename to test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_assignable.pass.cpp index aa604a9f2..2ec06a09e 100644 --- a/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_assign.pass.cpp +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_assignable.pass.cpp @@ -9,14 +9,14 @@ // type_traits -// has_trivial_copy_assign +// is_trivially_copy_assignable #include template void test_has_trivial_assign() { - static_assert(std::has_trivial_copy_assign::value == Result, ""); + static_assert(std::is_trivially_copy_assignable::value == Result, ""); } class Empty @@ -49,12 +49,10 @@ int main() { test_has_trivial_assign(); test_has_trivial_assign(); - test_has_trivial_assign(); + test_has_trivial_assign(); test_has_trivial_assign(); test_has_trivial_assign(); test_has_trivial_assign(); - test_has_trivial_assign(); - test_has_trivial_assign(); test_has_trivial_assign(); test_has_trivial_assign(); diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_constructible.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_constructible.pass.cpp new file mode 100644 index 000000000..45f63622f --- /dev/null +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_constructible.pass.cpp @@ -0,0 +1,77 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_trivially_copy_constructible + +#include + +template +void test_is_trivially_copy_constructible() +{ + static_assert( std::is_trivially_copy_constructible::value, ""); + static_assert( std::is_trivially_copy_constructible::value, ""); + static_assert( std::is_trivially_copy_constructible::value, ""); + static_assert( std::is_trivially_copy_constructible::value, ""); +} + +template +void test_has_not_trivial_copy_constructor() +{ + static_assert(!std::is_trivially_copy_constructible::value, ""); + static_assert(!std::is_trivially_copy_constructible::value, ""); + static_assert(!std::is_trivially_copy_constructible::value, ""); + static_assert(!std::is_trivially_copy_constructible::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ +public: + virtual ~Abstract() = 0; +}; + +struct A +{ + A(const A&); +}; + +int main() +{ + test_has_not_trivial_copy_constructor(); + test_has_not_trivial_copy_constructor(); + test_has_not_trivial_copy_constructor(); + test_has_not_trivial_copy_constructor(); + + test_is_trivially_copy_constructible(); + test_is_trivially_copy_constructible(); + test_is_trivially_copy_constructible(); + test_is_trivially_copy_constructible(); + test_is_trivially_copy_constructible(); + test_is_trivially_copy_constructible(); + test_is_trivially_copy_constructible(); + test_is_trivially_copy_constructible(); +} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_default_constructible.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_default_constructible.pass.cpp new file mode 100644 index 000000000..1f63401da --- /dev/null +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_default_constructible.pass.cpp @@ -0,0 +1,76 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_trivially_default_constructible + +#include + +template +void test_is_trivially_default_constructible() +{ + static_assert( std::is_trivially_default_constructible::value, ""); + static_assert( std::is_trivially_default_constructible::value, ""); + static_assert( std::is_trivially_default_constructible::value, ""); + static_assert( std::is_trivially_default_constructible::value, ""); +} + +template +void test_has_not_trivial_default_constructor() +{ + static_assert(!std::is_trivially_default_constructible::value, ""); + static_assert(!std::is_trivially_default_constructible::value, ""); + static_assert(!std::is_trivially_default_constructible::value, ""); + static_assert(!std::is_trivially_default_constructible::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +struct A +{ + A(); +}; + +int main() +{ + test_has_not_trivial_default_constructor(); + test_has_not_trivial_default_constructor(); + test_has_not_trivial_default_constructor(); + test_has_not_trivial_default_constructor(); + test_has_not_trivial_default_constructor(); + + test_is_trivially_default_constructible(); + test_is_trivially_default_constructible(); + test_is_trivially_default_constructible(); + test_is_trivially_default_constructible(); + test_is_trivially_default_constructible(); + test_is_trivially_default_constructible(); + test_is_trivially_default_constructible(); + test_is_trivially_default_constructible(); +} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp new file mode 100644 index 000000000..ebe10e320 --- /dev/null +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp @@ -0,0 +1,77 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_trivially_destructible + +#include + +template +void test_is_trivially_destructible() +{ + static_assert( std::is_trivially_destructible::value, ""); + static_assert( std::is_trivially_destructible::value, ""); + static_assert( std::is_trivially_destructible::value, ""); + static_assert( std::is_trivially_destructible::value, ""); +} + +template +void test_has_not_trivial_destructor() +{ + static_assert(!std::is_trivially_destructible::value, ""); + static_assert(!std::is_trivially_destructible::value, ""); + static_assert(!std::is_trivially_destructible::value, ""); + static_assert(!std::is_trivially_destructible::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +struct A +{ + ~A(); +}; + +int main() +{ + test_has_not_trivial_destructor(); + test_has_not_trivial_destructor(); + test_has_not_trivial_destructor(); + test_has_not_trivial_destructor(); + + test_is_trivially_destructible(); + test_is_trivially_destructible(); + test_is_trivially_destructible(); + test_is_trivially_destructible(); + test_is_trivially_destructible(); + test_is_trivially_destructible(); + test_is_trivially_destructible(); + test_is_trivially_destructible(); + test_is_trivially_destructible(); + test_is_trivially_destructible(); +} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_assignable.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_assignable.pass.cpp new file mode 100644 index 000000000..dcdaa25b1 --- /dev/null +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_assignable.pass.cpp @@ -0,0 +1,64 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_trivially_move_assignable + +#include + +template +void test_has_trivial_assign() +{ + static_assert(std::is_trivially_move_assignable::value == Result, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +struct A +{ + A& operator=(const A&); +}; + +int main() +{ + test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); + + test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); +} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_constructible.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_constructible.pass.cpp new file mode 100644 index 000000000..a4fcbcb09 --- /dev/null +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_constructible.pass.cpp @@ -0,0 +1,77 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_trivially_move_constructible + +#include + +template +void test_is_trivially_move_constructible() +{ + static_assert( std::is_trivially_move_constructible::value, ""); + static_assert( std::is_trivially_move_constructible::value, ""); + static_assert( std::is_trivially_move_constructible::value, ""); + static_assert( std::is_trivially_move_constructible::value, ""); +} + +template +void test_has_not_trivial_move_constructor() +{ + static_assert(!std::is_trivially_move_constructible::value, ""); + static_assert(!std::is_trivially_move_constructible::value, ""); + static_assert(!std::is_trivially_move_constructible::value, ""); + static_assert(!std::is_trivially_move_constructible::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ +public: + virtual ~Abstract() = 0; +}; + +struct A +{ + A(const A&); +}; + +int main() +{ + test_has_not_trivial_move_constructor(); + test_has_not_trivial_move_constructor(); + test_has_not_trivial_move_constructor(); + test_has_not_trivial_move_constructor(); + + test_is_trivially_move_constructible(); + test_is_trivially_move_constructible(); + test_is_trivially_move_constructible(); + test_is_trivially_move_constructible(); + test_is_trivially_move_constructible(); + test_is_trivially_move_constructible(); + test_is_trivially_move_constructible(); + test_is_trivially_move_constructible(); +}