From: Ville Voutilainen Date: Thu, 11 May 2017 07:44:29 +0000 (+0300) Subject: re PR c++/80682 (__is_trivially_constructible(void, int) returns true.) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e81c832812e5432cb849146ca44ed64727e672af;p=gcc.git re PR c++/80682 (__is_trivially_constructible(void, int) returns true.) PR c++/80682 cp/ PR c++/80682 * method.c (is_trivially_xible): Reject void types. testsuite/ PR c++/80682 * g++.dg/ext/is_trivially_constructible1.C: Add tests for void target. From-SVN: r247880 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 392323d5e8d..af7fae58555 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2017-05-11 Ville Voutilainen + + PR c++/80682 + * method.c (is_trivially_xible): Reject void types. + 2017-05-10 Nathan Sidwell * class.c (handle_using_decl): Always use OVL_CURRENT. diff --git a/gcc/cp/method.c b/gcc/cp/method.c index a0ca36dfd02..99e98cce807 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -1207,6 +1207,8 @@ constructible_expr (tree to, tree from) bool is_trivially_xible (enum tree_code code, tree to, tree from) { + if (VOID_TYPE_P (to)) + return false; tree expr; if (code == MODIFY_EXPR) expr = assignable_expr (to, from); diff --git a/gcc/testsuite/g++.dg/ext/is_trivially_constructible1.C b/gcc/testsuite/g++.dg/ext/is_trivially_constructible1.C index a5bac7b482e..175eae98233 100644 --- a/gcc/testsuite/g++.dg/ext/is_trivially_constructible1.C +++ b/gcc/testsuite/g++.dg/ext/is_trivially_constructible1.C @@ -27,10 +27,18 @@ SA(!__is_trivially_constructible(C,C&)); SA(__is_trivially_assignable(C,C&)); SA(!__is_trivially_assignable(C,C)); SA(!__is_trivially_assignable(C,C&&)); +SA(!__is_trivially_assignable(void,int)); +SA(!__is_trivially_assignable(const void,int)); +SA(!__is_trivially_assignable(volatile void,int)); +SA(!__is_trivially_assignable(const volatile void,int)); SA(__is_trivially_constructible(int,int)); SA(__is_trivially_constructible(int,double)); SA(!__is_trivially_constructible(int,B)); +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(D));