================ @@ -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:
If the goal is to inspect the bytes of the source object, then it's not UB because that inspection would be happening on a byte-by-byte level and not on the value representation level. So the `memcpy` itself is not really UB because it is only touching on a byte-by-byte level. Where I think the UB comes in is when someone attempts to use the `_Alias` object constructed by the call to `memcpy` because that object may not have a valid representation. https://eel.is/c++draft/basic.indet#1.sentence-3 https://eel.is/c++draft/conv.lval#3.4 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