================
@@ -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));
----------------
carlosgalvezp wrote:

Also, [[intro.object]#8.4](https://eel.is/c++draft/intro.object#8.4) says:

> An object of trivially copyable or standard-layout type 
> ([[basic.types.general]](https://eel.is/c++draft/basic.types.general)) shall 
> occupy contiguous bytes of 
> storage[.](https://eel.is/c++draft/intro.object#8.sentence-5)

`std::memcpy` assumes the bytes of the object are laid contiguously in memory, 
so I guess that's a requirement that also applies to the `src` parameter, not 
just `dst`.

Not saying we should enforce this in this warning, but this could explain the 
requirement for TriviallyCopyable.

https://github.com/llvm/llvm-project/pull/111434
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to