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
This commit is contained in:
Ville Voutilainen 2018-07-04 22:21:38 +03:00 committed by Ville Voutilainen
parent 86b664c0a9
commit a617812f14
3 changed files with 12 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2018-07-04 Ville Voutilainen <ville.voutilainen@gmail.com>
PR c++/86398
* method.c (is_trivially_xible): Return false
if is_xible_helper returns a NULL_TREE.
2018-07-03 Paolo Carlini <paolo.carlini@oracle.com>
* decl.c (min_location): New.

View File

@ -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;

View File

@ -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));