Copilot commented on code in PR #55764:
URL: https://github.com/apache/arrow/pull/55764#discussion_r4682301838
##########
cpp/src/arrow/util/ubsan.h:
##########
@@ -82,11 +82,7 @@ ARROW_FORCE_INLINE
U>
SafeCopy(T value) {
using TypeU = std::remove_const_t<U>;
- arrow::internal::AlignedStorage<TypeU> raw_data;
- std::memcpy(raw_data.get(), static_cast<const void*>(&value), sizeof(T));
- auto data = *raw_data.get();
- raw_data.destroy();
- return data;
+ return std::bit_cast<TypeU>(value);
Review Comment:
Please add `#include <bit>` to this header so `std::bit_cast` is declared
directly. Without it, compilation depends on incidental transitive includes and
fails when those do not expose `std::bit_cast`, even if `SafeCopy` is never
instantiated.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]