mirror of git://gcc.gnu.org/git/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
This commit is contained in:
parent
90fc44ecfa
commit
e9029d55f2
|
|
@ -1,5 +1,15 @@
|
||||||
2018-07-04 Jonathan Wakely <jwakely@redhat.com>
|
2018-07-04 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
|
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.
|
* include/std/bit (__rotl, __rotr): Avoid branch.
|
||||||
(_If_is_unsigned_integer): Use remove_cv_t.
|
(_If_is_unsigned_integer): Use remove_cv_t.
|
||||||
* testsuite/26_numerics/bit/bitops.count/popcount.cc: New.
|
* testsuite/26_numerics/bit/bitops.count/popcount.cc: New.
|
||||||
|
|
|
||||||
|
|
@ -1136,7 +1136,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
/// is_trivially_constructible
|
/// is_trivially_constructible
|
||||||
template<typename _Tp, typename... _Args>
|
template<typename _Tp, typename... _Args>
|
||||||
struct is_trivially_constructible
|
struct is_trivially_constructible
|
||||||
: public __bool_constant<__is_trivially_constructible(_Tp, _Args...)>
|
: public __and_<is_constructible<_Tp, _Args...>, __bool_constant<
|
||||||
|
__is_trivially_constructible(_Tp, _Args...)>>::type
|
||||||
{ };
|
{ };
|
||||||
|
|
||||||
/// is_trivially_default_constructible
|
/// is_trivially_default_constructible
|
||||||
|
|
@ -1159,21 +1160,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
|
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
struct __is_implicitly_default_constructible_impl
|
struct __is_implicitly_default_constructible_impl
|
||||||
: public __do_is_implicitly_default_constructible_impl
|
: public __do_is_implicitly_default_constructible_impl
|
||||||
{
|
{
|
||||||
typedef decltype(__test(declval<_Tp>())) type;
|
typedef decltype(__test(declval<_Tp>())) type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
struct __is_implicitly_default_constructible_safe
|
struct __is_implicitly_default_constructible_safe
|
||||||
: public __is_implicitly_default_constructible_impl<_Tp>::type
|
: public __is_implicitly_default_constructible_impl<_Tp>::type
|
||||||
{ };
|
{ };
|
||||||
|
|
||||||
template <typename _Tp>
|
template <typename _Tp>
|
||||||
struct __is_implicitly_default_constructible
|
struct __is_implicitly_default_constructible
|
||||||
: public __and_<is_default_constructible<_Tp>,
|
: public __and_<is_default_constructible<_Tp>,
|
||||||
__is_implicitly_default_constructible_safe<_Tp>>
|
__is_implicitly_default_constructible_safe<_Tp>>
|
||||||
{ };
|
{ };
|
||||||
|
|
||||||
/// is_trivially_copy_constructible
|
/// is_trivially_copy_constructible
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,24 @@ void test01()
|
||||||
int, int&&>(true), "");
|
int, int&&>(true), "");
|
||||||
static_assert(test_property<is_trivially_constructible,
|
static_assert(test_property<is_trivially_constructible,
|
||||||
int, const int&>(true), "");
|
int, const int&>(true), "");
|
||||||
|
static_assert(test_property<is_trivially_constructible,
|
||||||
|
int, void*>(false), "PR 86398");
|
||||||
|
static_assert(test_property<is_trivially_constructible,
|
||||||
|
int, int*>(false), "PR 86398");
|
||||||
|
static_assert(test_property<is_trivially_constructible,
|
||||||
|
int, const int*>(false), "PR 86398");
|
||||||
|
static_assert(test_property<is_trivially_constructible,
|
||||||
|
int*, void*>(false), "PR 86398");
|
||||||
|
static_assert(test_property<is_trivially_constructible,
|
||||||
|
int*, const int*>(false), "PR 86398");
|
||||||
|
static_assert(test_property<is_trivially_constructible,
|
||||||
|
int&, const int>(false), "");
|
||||||
|
static_assert(test_property<is_trivially_constructible,
|
||||||
|
const int&, int>(true), "");
|
||||||
|
static_assert(test_property<is_trivially_constructible,
|
||||||
|
const int&, int&>(true), "");
|
||||||
|
static_assert(test_property<is_trivially_constructible,
|
||||||
|
const int*, int*>(true), "");
|
||||||
static_assert(test_property<is_trivially_constructible,
|
static_assert(test_property<is_trivially_constructible,
|
||||||
PolymorphicClass>(false), "");
|
PolymorphicClass>(false), "");
|
||||||
static_assert(test_property<is_trivially_constructible,
|
static_assert(test_property<is_trivially_constructible,
|
||||||
|
|
@ -162,6 +180,4 @@ void test01()
|
||||||
MoveOnly, const MoveOnly&>(false), "");
|
MoveOnly, const MoveOnly&>(false), "");
|
||||||
static_assert(test_property<is_trivially_constructible,
|
static_assert(test_property<is_trivially_constructible,
|
||||||
MoveOnly2>(false), "");
|
MoveOnly2>(false), "");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,4 +47,4 @@ void test01()
|
||||||
// { dg-error "required from here" "" { target *-*-* } 39 }
|
// { dg-error "required from here" "" { target *-*-* } 39 }
|
||||||
// { dg-error "required from here" "" { target *-*-* } 41 }
|
// { 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 }
|
||||||
|
|
|
||||||
|
|
@ -47,5 +47,4 @@ void test01()
|
||||||
// { dg-error "required from here" "" { target *-*-* } 39 }
|
// { dg-error "required from here" "" { target *-*-* } 39 }
|
||||||
// { dg-error "required from here" "" { target *-*-* } 41 }
|
// { 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 }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue