From: Ville Voutilainen Date: Wed, 4 Jul 2018 19:21:38 +0000 (+0300) Subject: re PR c++/86398 (is_trivially_constructible always returns true even when is_construc... X-Git-Tag: basepoints/gcc-10~5524 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a617812f148c71209a94f33879b13fa603c6103c;p=thirdparty%2Fgcc.git re PR c++/86398 (is_trivially_constructible always returns true even when is_constructible returns false) PR c++/86398 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. From-SVN: r262420 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c27e2deb2ce2..efa3cbdd6536 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-07-04 Ville Voutilainen + + PR c++/86398 + * method.c (is_trivially_xible): Return false + if is_xible_helper returns a NULL_TREE. + 2018-07-03 Paolo Carlini * decl.c (min_location): New. diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 858655b4a791..0b208a8d52a5 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 175eae98233f..191b69601e68 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));