[clang] [libcxx] [clang] Warn about memset/memcpy to NonTriviallyCopyable types (PR #111434)
Nikolas Klauser via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 24 14:16:35 PDT 2024
================
@@ -638,7 +638,7 @@ __uninitialized_allocator_relocate(_Alloc& __alloc, _Tp* __first, _Tp* __last, _
__guard.__complete();
std::__allocator_destroy(__alloc, __first, __last);
} else {
- __builtin_memcpy(__result, __first, sizeof(_Tp) * (__last - __first));
+ __builtin_memcpy((void*)__result, __first, sizeof(_Tp) * (__last - __first));
----------------
philnik777 wrote:
I think it would be better to make these `static_cast`s to make it obvious that we're casting from a different pointer. Could you also add a comment like `// casting to void* to suppress clang complaining that this is technically UB`?
https://github.com/llvm/llvm-project/pull/111434
More information about the cfe-commits
mailing list