From a617812f148c71209a94f33879b13fa603c6103c Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Wed, 4 Jul 2018 22:21:38 +0300 Subject: [PATCH] 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 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/method.c | 2 +- gcc/testsuite/g++.dg/ext/is_trivially_constructible1.C | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c27e2deb2ce..efa3cbdd653 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 858655b4a79..0b208a8d52a 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 175eae98233..191b69601e6 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)); -- 2.30.2