Skip to content
/ arrow Public
forked from apache/arrow

Commit

Permalink
apacheGH-42536: [C++] Replace std::aligned_storage that is deprecated…
Browse files Browse the repository at this point in the history
… in C++23

Fixes apache#41536
  • Loading branch information
sjoubert committed Dec 13, 2024
1 parent a1627b9 commit c86bfe0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
15 changes: 0 additions & 15 deletions cpp/cmake_modules/SetupCxxFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -163,21 +163,6 @@ if(WIN32)
# insecure, like std::getenv
add_definitions(-D_CRT_SECURE_NO_WARNINGS)

# Disable static assertion in Microsoft C++ standard library.
#
# """[...]\include\type_traits(1271): error C2338:
# You've instantiated std::aligned_storage<Len, Align> with an extended
# alignment (in other words, Align > alignof(max_align_t)).
# Before VS 2017 15.8, the member type would non-conformingly have an
# alignment of only alignof(max_align_t). VS 2017 15.8 was fixed to handle
# this correctly, but the fix inherently changes layout and breaks binary
# compatibility (*only* for uses of aligned_storage with extended alignments).
# Please define either (1) _ENABLE_EXTENDED_ALIGNED_STORAGE to acknowledge
# that you understand this message and that you actually want a type with
# an extended alignment, or (2) _DISABLE_EXTENDED_ALIGNED_STORAGE to silence
# this message and get the old non-conformant behavior."""
add_definitions(-D_ENABLE_EXTENDED_ALIGNED_STORAGE)

if(MSVC)
# ARROW-1931 See https://github.com/google/googletest/issues/1318
#
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/util/aligned_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class AlignedStorage {

typename std::aligned_storage<sizeof(T), alignment()>::type data_;
#else
typename std::aligned_storage<sizeof(T), alignof(T)>::type data_;
alignas(T) std::byte data_[sizeof(T)];
#endif
};

Expand Down

0 comments on commit c86bfe0

Please sign in to comment.