commit 82960cb6e64ca78b53fb799318087cb23b942079 Author: Jonathan Wakely Date: Thu Jul 19 17:03:33 2018 +0100 Simplify the base characteristics for some type traits * include/std/type_traits (__is_member_object_pointer_helper): Use __not_>::type instead of integral_constant. (__is_member_function_pointer_helper): Likewise for is_function<_Tp>::type. (is_compund): Likewise for __not_>::type. (__do_is_nt_destructible_impl): Use __bool_constant and reindent. (is_trivially_constructible): Remove redundant use of is_constructible. (__is_trivially_copy_assignable_impl): Remove redundant use of is_copy_assignable. (__is_trivially_move_assignable_impl): Remove redundant use of is_move_assignable. (is_trivially_destructible): Use __bool_constant. * testsuite/20_util/is_trivially_assignable/value.cc: Add some more tests for scalar types. diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 4df82bf6d8c..aaa554c6200 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -396,7 +396,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct __is_member_object_pointer_helper<_Tp _Cp::*> - : public integral_constant::value> { }; + : public __not_>::type { }; /// is_member_object_pointer template @@ -411,7 +411,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct __is_member_function_pointer_helper<_Tp _Cp::*> - : public integral_constant::value> { }; + : public is_function<_Tp>::type { }; /// is_member_function_pointer template @@ -603,7 +603,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// is_compound template struct is_compound - : public integral_constant::value> { }; + : public __not_>::type { }; template struct __is_member_pointer_helper @@ -826,8 +826,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct __do_is_nt_destructible_impl { template - static integral_constant().~_Tp())> - __test(int); + static __bool_constant().~_Tp())> + __test(int); template static false_type __test(...); @@ -1136,8 +1136,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// is_trivially_constructible template struct is_trivially_constructible - : public __and_, __bool_constant< - __is_trivially_constructible(_Tp, _Args...)>>::type + : public __bool_constant<__is_trivially_constructible(_Tp, _Args...)> { }; /// is_trivially_default_constructible @@ -1235,9 +1234,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct __is_trivially_copy_assignable_impl<_Tp, true> - : public __and_, - integral_constant> + : public __bool_constant<__is_trivially_assignable(_Tp&, const _Tp&)> { }; template @@ -1256,9 +1253,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct __is_trivially_move_assignable_impl<_Tp, true> - : public __and_, - integral_constant> + : public __bool_constant<__is_trivially_assignable(_Tp&, _Tp&&)> { }; template @@ -1269,8 +1264,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// is_trivially_destructible template struct is_trivially_destructible - : public __and_, integral_constant> + : public __and_, + __bool_constant<__has_trivial_destructor(_Tp)>> { }; diff --git a/libstdc++-v3/testsuite/20_util/is_trivially_assignable/value.cc b/libstdc++-v3/testsuite/20_util/is_trivially_assignable/value.cc index 1015d07c314..f3d73cb7e98 100644 --- a/libstdc++-v3/testsuite/20_util/is_trivially_assignable/value.cc +++ b/libstdc++-v3/testsuite/20_util/is_trivially_assignable/value.cc @@ -44,91 +44,113 @@ void test01() using std::is_trivially_assignable; using namespace __gnu_test; - static_assert(test_property(false), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(false), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(false), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(false), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); }