Message ID | CAFk2RUbv6GpSG+2p2v4NqZkvq8gpmVNmn+VEyuwjQNsw1DnDfA@mail.gmail.com |
---|---|
State | New |
Headers | show |
Series | [C++] PR c++/86398 | expand |
Ok. On Wed, Jul 4, 2018, 11:52 AM Ville Voutilainen <ville.voutilainen@gmail.com> wrote: > This has been buggy for a while, but since we were implementing > the library triviality traits in terms of just the intrinsic since GCC 8, > not too many users ran into it. The bug has been worked around > in the library, but I'd rather have the intrinsic give the right > answer and not require the library work-around. > > Tested on Linux-PPC64, ok for trunk and the gcc-8 branch? > > 2018-07-04 Ville Voutilainen <ville.voutilainen@gmail.com> > > gcc/cp/ > > PR c++/86398 > * method.c (is_trivially_xible): Return false > if is_xible_helper returns a NULL_TREE. > > testsuite/ > > PR c++/86398 > * g++.dg/ext/is_trivially_constructible1.C: Add new tests. >
diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 858655b..0b208a8 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -1216,7 +1216,7 @@ is_trivially_xible (enum tree_code code, tree to, tree from) tree expr; expr = is_xible_helper (code, to, from, /*trivial*/true); - if (expr == error_mark_node) + if (expr == NULL_TREE || expr == error_mark_node) return false; tree nt = cp_walk_tree_without_duplicates (&expr, check_nontriv, NULL); return !nt; diff --git a/gcc/testsuite/g++.dg/ext/is_trivially_constructible1.C b/gcc/testsuite/g++.dg/ext/is_trivially_constructible1.C index 175eae9..191b696 100644 --- a/gcc/testsuite/g++.dg/ext/is_trivially_constructible1.C +++ b/gcc/testsuite/g++.dg/ext/is_trivially_constructible1.C @@ -39,6 +39,11 @@ SA(!__is_trivially_constructible(void,int)); SA(!__is_trivially_constructible(const void,int)); SA(!__is_trivially_constructible(volatile void,int)); SA(!__is_trivially_constructible(const volatile void,int)); +SA(!__is_trivially_constructible(int, void*)); +SA(!__is_trivially_constructible(int, int*)); +SA(!__is_trivially_constructible(int, const int*)); +SA(!__is_trivially_constructible(int*, void*)); +SA(!__is_trivially_constructible(int*, const int*)); SA(!__is_trivially_constructible(D));