re PR c++/80682 (__is_trivially_constructible(void, int) returns true.)
authorVille Voutilainen <ville.voutilainen@gmail.com>
Thu, 11 May 2017 07:44:29 +0000 (10:44 +0300)
committerVille Voutilainen <ville@gcc.gnu.org>
Thu, 11 May 2017 07:44:29 +0000 (10:44 +0300)
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

gcc/cp/ChangeLog
gcc/cp/method.c
gcc/testsuite/g++.dg/ext/is_trivially_constructible1.C

index 392323d5e8d8f41b3d70c0ea6779851e2aedacba..af7fae58555afe4a7148621f20b5e798b04413c8 100644 (file)
@@ -1,3 +1,8 @@
+2017-05-11  Ville Voutilainen  <ville.voutilainen@gmail.com>
+
+       PR c++/80682
+       * method.c (is_trivially_xible): Reject void types.
+
 2017-05-10  Nathan Sidwell  <nathan@acm.org>
 
        * class.c (handle_using_decl): Always use OVL_CURRENT.
index a0ca36dfd0246a122bc2808b88814e821269c26a..99e98cce807acfd8747f901e99e9cf5ca4c3ec65 100644 (file)
@@ -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);
index a5bac7b482e58c1f5d71380e3647edab938ba7d6..175eae98233f1d43ef34962034bbe41d214165a9 100644 (file)
@@ -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));