GH-41536: [C++] Replace std::aligned_storage that is deprecated in C++23 #45019
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes #41536
Rationale for this change
C++23 deprecates
std::aligned_storage. The recommended alternative is an array ofstd::byteproperly marked withalignas(). This change is compatible with C++17 and should also allow users to compile their code in C++23 mode without deprecation warnings.What changes are included in this PR?
This replaces
std::aligned_storageas recommended and also removes a preprocessor define that was needed for MSVC.However there is still one usage of
std::aligned_storagein a conditional to work around a GCC bug on i386:alignasas a replacement would have the same bug as the originalalignofIf someone can confirm that it is ok to clean the code and use the same code unconditionally I'll update my changes.