diff --git a/cpp/src/arrow/util/ubsan.h b/cpp/src/arrow/util/ubsan.h index 900d8011dfd69..2308ee33519ca 100644 --- a/cpp/src/arrow/util/ubsan.h +++ b/cpp/src/arrow/util/ubsan.h @@ -63,7 +63,7 @@ inline std::enable_if_t, T> SafeLoadAs( template inline std::enable_if_t, T> SafeLoad(const T* unaligned) { std::remove_const_t ret; - std::memcpy(&ret, unaligned, sizeof(T)); + std::memcpy(&ret, static_cast(unaligned), sizeof(T)); return ret; } @@ -73,7 +73,7 @@ inline std::enable_if_t && U> SafeCopy(T value) { std::remove_const_t ret; - std::memcpy(&ret, &value, sizeof(T)); + std::memcpy(&ret, static_cast(&value), sizeof(T)); return ret; }