https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81327

--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
I don't consider this a regression.  The warnings are justified and it wasn't a
design goal to let casts suppress them.  I agree it would be useful for
compatibility with Clang (that's why I raised the bug), but making it possible
is an enhancement.  Until it's implemented, the warnings can be selectively
suppressed via GCC's diagnostic pragmas:

void g (struct S *s)
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wclass-memaccess"
  __builtin_memset ((void*)s, 0, sizeof *s);
#pragma GCC diagnostic pop
}

Reply via email to