https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107361
Peter Kasting <pkasting at google dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pkasting at google dot com --- Comment #3 from Peter Kasting <pkasting at google dot com> --- This warning fired in Chromium on safe code that clang doesn't warn about, for similar reasons as the reporter here complains about. I think the linked patch was too aggressive. At the very least, `memcpy()` from some instance `t1` of a `T` into another instance `t2` of a `T` should only require that `T` is trivially-copyable. Since we can assume that `t1`'s invariants held before the statement, after it `t2`'s invariants must hold (or the coder should not have allowed trivial copyability, which is a distinct bug). I do agree with the original patch author that `memset()` probably requires the type to be trivial rather than just trivially-copyable. We can work around with cast-to-`void*` prior to `memcpy()`, which feels unfortunate given that the intent of that is less obvious to a reader, and it's probably easier to introduce dangerous behavior later.