[clang] [compiler-rt] [libcxx] [llvm] [clang] Warn about memset/memcpy to NonTriviallyCopyable types (PR #111434)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 17 09:06:20 PDT 2024
================
@@ -102,7 +102,7 @@ struct __aliasing_iterator_wrapper {
_LIBCPP_HIDE_FROM_ABI _Alias operator*() const _NOEXCEPT {
_Alias __val;
- __builtin_memcpy(&__val, std::__to_address(__base_), sizeof(value_type));
+ __builtin_memcpy(&__val, static_cast<const void*>(std::__to_address(__base_)), sizeof(value_type));
----------------
AaronBallman wrote:
Yeah, this seems like it's plausibly UB. There's an assertion that `__val` is trivial, but I'm not seeing any such assertion for `__base_`; does something else ensure that `_BaseIter` is trivial?
https://github.com/llvm/llvm-project/pull/111434
More information about the cfe-commits
mailing list