Skip to content

Commit dff4b7c

Browse files
committed
remove launder
1 parent 1eb9ce4 commit dff4b7c

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

cpp/src/arrow/util/ubsan.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
#include <cstring>
2323
#include <memory>
24-
#include <new>
2524
#include <type_traits>
2625

2726
#include "arrow/util/aligned_storage.h"
@@ -69,8 +68,7 @@ template <typename T>
6968
inline std::enable_if_t<std::is_trivially_copyable_v<T>, T> SafeLoad(const T* unaligned) {
7069
using Type = std::remove_const_t<T>;
7170
arrow::internal::AlignedStorage<Type> raw_data;
72-
std::memcpy(raw_data.get(), std::launder(reinterpret_cast<const uint8_t*>(unaligned)),
73-
sizeof(T));
71+
std::memcpy(raw_data.get(), static_cast<const void*>(unaligned), sizeof(T));
7472
auto data = *raw_data.get();
7573
raw_data.destroy();
7674
return data;
@@ -83,8 +81,7 @@ inline std::enable_if_t<std::is_trivially_copyable_v<T> &&
8381
SafeCopy(T value) {
8482
using TypeU = std::remove_const_t<U>;
8583
arrow::internal::AlignedStorage<TypeU> raw_data;
86-
std::memcpy(raw_data.get(), std::launder(reinterpret_cast<const uint8_t*>(&value)),
87-
sizeof(T));
84+
std::memcpy(raw_data.get(), static_cast<const void*>(&value), sizeof(T));
8885
auto data = *raw_data.get();
8986
raw_data.destroy();
9087
return data;

0 commit comments

Comments
 (0)