mirror of
https://git.freebsd.org/src.git
synced 2026-01-16 23:02:24 +00:00
libc++: silence -Wnontrivial-memaccess warning with newer clang
Apply part of LLVM commit 71315698c91d0cda054b903da0594ca6f072c350 to silence the -Wnontrivial-memaccess warning that is triggered any time this function is instantiated by user code. This fixes another buildworld failure with Clang HEAD. Original commit message: [clang] Warn about memset/memcpy to NonTriviallyCopyable types (#111434) This implements a warning that's similar to what GCC does in that context: both memcpy and memset require their first and second operand to be trivially copyable, let's warn if that's not the case. Reviewed by: emaste, dim MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D52534
This commit is contained in:
parent
086ce467ad
commit
34a006eaa3
1 changed files with 2 additions and 1 deletions
|
|
@ -642,7 +642,8 @@ __uninitialized_allocator_relocate(_Alloc& __alloc, _Tp* __first, _Tp* __last, _
|
|||
__guard.__complete();
|
||||
std::__allocator_destroy(__alloc, __first, __last);
|
||||
} else {
|
||||
__builtin_memcpy(const_cast<__remove_const_t<_Tp>*>(__result), __first, sizeof(_Tp) * (__last - __first));
|
||||
// Casting to void* to suppress clang complaining that this is technically UB.
|
||||
__builtin_memcpy(static_cast<void*>(const_cast<__remove_const_t<_Tp>*>(__result)), __first, sizeof(_Tp) * (__last - __first));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue