PR c++/84851 - missing -Wclass-memaccess for a memcpy in a copy ctor with a non-trivi...
authorMartin Sebor <msebor@redhat.com>
Wed, 24 Oct 2018 18:06:14 +0000 (18:06 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Wed, 24 Oct 2018 18:06:14 +0000 (12:06 -0600)
gcc/cp/ChangeLog:

PR c++/84851
* call.c (maybe_warn_class_memaccess): Tighten up.

gcc/testsuite/ChangeLog:

PR c++/84851
* g++.dg/Wclass-memaccess-4.C: Remove XFAIL.

From-SVN: r265467

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/Wclass-memaccess-4.C

index c04dbe840057394c2789be0159dab0a7d277e724..fad8690810265c3a0f698e22a98155b48cb412c4 100644 (file)
@@ -1,3 +1,8 @@
+2018-10-24  Martin Sebor  <msebor@redhat.com>
+
+       PR c++/84851
+       * call.c (maybe_warn_class_memaccess): Tighten up.
+
 2018-10-17  David Malcolm  <dmalcolm@redhat.com>
 
        * Make-lang.in (selftest-c++): New.
index 0baf26e43460e7f061f606e5a6b423c4995333b6..cd0c0f60cedbe4b2f50c00eec06c61975c02dfee 100644 (file)
@@ -8665,15 +8665,6 @@ maybe_warn_class_memaccess (location_t loc, tree fndecl,
       bool special = same_type_ignoring_top_level_qualifiers_p (ctx, desttype);
       tree binfo = TYPE_BINFO (ctx);
 
-      /* FIXME: The following if statement is overly permissive (see
-        bug 84851).  Remove it in GCC 9.  */
-      if (special
-         && !BINFO_VTABLE (binfo)
-         && !BINFO_N_BASE_BINFOS (binfo)
-         && (DECL_CONSTRUCTOR_P (current_function_decl)
-             || DECL_DESTRUCTOR_P (current_function_decl)))
-       return;
-
       if (special
          && !BINFO_VTABLE (binfo)
          && !first_non_trivial_field (desttype))
index e1679013d088a026265316f63863764d4afa702d..6f9ba884e04afbf83cf0ce38e564b5fd435a6dac 100644 (file)
@@ -1,3 +1,8 @@
+2018-10-24  Martin Sebor  <msebor@redhat.com>
+
+       PR c++/84851
+       * g++.dg/Wclass-memaccess-4.C: Remove XFAIL.
+
 2018-10-24  Martin Liska  <mliska@suse.cz>
 
        PR tree-optimization/84436
index 8c334219099ecb3948a17ea470d2cd29b47cd014..69b8c780c8b73fb93c493d435d356005ad13fa01 100644 (file)
@@ -29,7 +29,7 @@ struct C
 
 C::C (const C &c)
 {
-  memcpy (this, &c, sizeof c);    // { dg-warning "\\\[-Wclass-memaccess]" "pr84851" { xfail *-*-*} }
+  memcpy (this, &c, sizeof c);    // { dg-warning "\\\[-Wclass-memaccess]" }
 }
 
 C& C::operator= (const C &c)