[clang] [compiler-rt] [libcxx] [llvm] [clang] Warn about memset/memcpy to NonTriviallyCopyable types (PR #111434)

via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 9 05:13:30 PDT 2024


serge-sans-paille wrote:

> Please note: GCC is more strict; for std::memset, it requires the type to be trivial, not just trivially copyable:
> 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107361

ACK. Not a standard requirement though, is it?

> I want to remember it was also more strict for std::memcpy, but I haven't been able to reproduce it.
> 
> I haven't looked at the patch in detail but for consistency with GCC it should also support suppressing the warning by explictly casting the pointers to void* (maybe it's already in place).

Yeah, that's part of current logic clang in clang too (thus the various cast added in this PR)



https://github.com/llvm/llvm-project/pull/111434


More information about the cfe-commits mailing list