PR c++/84851 - missing -Wclass-memaccess for a memcpy in a copy ctor with a non-trivial member
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
This commit is contained in:
parent
313c39912b
commit
fd85b88869
@ -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>
|
2018-10-17 David Malcolm <dmalcolm@redhat.com>
|
||||||
|
|
||||||
* Make-lang.in (selftest-c++): New.
|
* Make-lang.in (selftest-c++): New.
|
||||||
|
@ -8665,15 +8665,6 @@ maybe_warn_class_memaccess (location_t loc, tree fndecl,
|
|||||||
bool special = same_type_ignoring_top_level_qualifiers_p (ctx, desttype);
|
bool special = same_type_ignoring_top_level_qualifiers_p (ctx, desttype);
|
||||||
tree binfo = TYPE_BINFO (ctx);
|
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
|
if (special
|
||||||
&& !BINFO_VTABLE (binfo)
|
&& !BINFO_VTABLE (binfo)
|
||||||
&& !first_non_trivial_field (desttype))
|
&& !first_non_trivial_field (desttype))
|
||||||
|
@ -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>
|
2018-10-24 Martin Liska <mliska@suse.cz>
|
||||||
|
|
||||||
PR tree-optimization/84436
|
PR tree-optimization/84436
|
||||||
|
@ -29,7 +29,7 @@ struct C
|
|||||||
|
|
||||||
C::C (const C &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)
|
C& C::operator= (const C &c)
|
||||||
|
Loading…
Reference in New Issue
Block a user