================
@@ -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));
----------------
philnik777 wrote:
@AaronBallman IIUC you're saying that it would be UB if some padding bytes
ended up in the value representation of a different type, which could indeed
arguably be UB. We can't have this scenario here though, since we only
instantiate the type with integers as the `_Alias` and make sure that the
source objects have a unique object representation via
`__is_trivially_equality_comparable`.
I think it would be interesting to diagnose such cases, but that seems quite
complicated, since we'd have to check whether any padding bytes end up in
non-padding bytes. (though definitely not impossible)
https://github.com/llvm/llvm-project/pull/111434
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits