From: Jonathan Wakely Date: Wed, 4 Jul 2018 09:03:18 +0000 (+0100) Subject: PR libstdc++/86398 fix std::is_trivially_constructible regression X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e9029d55f24c824698de277abc1961e4673512db;p=gcc.git PR libstdc++/86398 fix std::is_trivially_constructible regression The intrinsic doesn't check for allowed conversions between scalar types, so restore the std::is_constructible check. Also make some trivial whitespace changes. PR libstdc++/86398 * include/std/type_traits (is_trivially_constructible): Check is_constructible before __is_trivially_constructible. * testsuite/20_util/is_trivially_constructible/value.cc: Add more tests, including negative cases. * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Use zero for dg-error lineno. * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Likewise. From-SVN: r262379 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index e3211bc819f..fa92b4bb489 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,15 @@ 2018-07-04 Jonathan Wakely + PR libstdc++/86398 + * include/std/type_traits (is_trivially_constructible): Check + is_constructible before __is_trivially_constructible. + * testsuite/20_util/is_trivially_constructible/value.cc: Add more + tests, including negative cases. + * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Use + zero for dg-error lineno. + * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: + Likewise. + * include/std/bit (__rotl, __rotr): Avoid branch. (_If_is_unsigned_integer): Use remove_cv_t. * testsuite/26_numerics/bit/bitops.count/popcount.cc: New. diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index accea6df648..4df82bf6d8c 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -1136,7 +1136,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// is_trivially_constructible template struct is_trivially_constructible - : public __bool_constant<__is_trivially_constructible(_Tp, _Args...)> + : public __and_, __bool_constant< + __is_trivially_constructible(_Tp, _Args...)>>::type { }; /// is_trivially_default_constructible @@ -1159,21 +1160,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct __is_implicitly_default_constructible_impl - : public __do_is_implicitly_default_constructible_impl - { - typedef decltype(__test(declval<_Tp>())) type; - }; + : public __do_is_implicitly_default_constructible_impl + { + typedef decltype(__test(declval<_Tp>())) type; + }; template struct __is_implicitly_default_constructible_safe - : public __is_implicitly_default_constructible_impl<_Tp>::type - { }; + : public __is_implicitly_default_constructible_impl<_Tp>::type + { }; template struct __is_implicitly_default_constructible - : public __and_, - __is_implicitly_default_constructible_safe<_Tp>> - { }; + : public __and_, + __is_implicitly_default_constructible_safe<_Tp>> + { }; /// is_trivially_copy_constructible diff --git a/libstdc++-v3/testsuite/20_util/is_trivially_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_trivially_constructible/value.cc index d2ab27df86f..f260c2a7927 100644 --- a/libstdc++-v3/testsuite/20_util/is_trivially_constructible/value.cc +++ b/libstdc++-v3/testsuite/20_util/is_trivially_constructible/value.cc @@ -44,124 +44,140 @@ void test01() using std::is_trivially_constructible; using namespace __gnu_test; - 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), "PR 86398"); + static_assert(test_property(false), "PR 86398"); + static_assert(test_property(false), "PR 86398"); + static_assert(test_property(false), "PR 86398"); + static_assert(test_property(false), "PR 86398"); + static_assert(test_property(false), ""); + 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(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(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(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(true), ""); - static_assert(test_property(false), ""); - static_assert(test_property(true), ""); - static_assert(test_property(false), ""); - 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(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(true), ""); - static_assert(test_property(false), ""); - static_assert(test_property(true), ""); - static_assert(test_property(false), ""); - static_assert(test_property(true), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - - } diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc index 1380fc55c82..53cdf61f496 100644 --- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc +++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc @@ -47,4 +47,4 @@ void test01() // { dg-error "required from here" "" { target *-*-* } 39 } // { dg-error "required from here" "" { target *-*-* } 41 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1825 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc index cbc5300c182..ec5b6111127 100644 --- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc +++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc @@ -47,5 +47,4 @@ void test01() // { dg-error "required from here" "" { target *-*-* } 39 } // { dg-error "required from here" "" { target *-*-* } 41 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1708 } - +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 0 }