-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[C++] std::aligned_storage is deprecated since C++23 #41536
Comments
@vient We're using C++17, what is the suggested replacement for this? |
// To replace std::aligned_storage
template <typename T>
class MyContainer {
private:
//std::aligned_storage_t<sizeof(T), alignof(T)> t_buff;
alignas(T) std::byte t_buff[sizeof(T)];
}; ¯\_(ツ)_/¯ |
…+23 (#45019) This fixes #41536 ### Rationale for this change C++23 deprecates `std::aligned_storage`. The recommended alternative is an array of `std::byte` properly marked with `alignas()`. 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_storage` as recommended and also removes a preprocessor define that was needed for MSVC. However there is still [one usage](https://github.com/apache/arrow/blob/main/cpp/src/arrow/util/aligned_storage.h#L122-L139) of `std::aligned_storage` in a conditional to work around a GCC bug on i386: * I don't know if `alignas` as a replacement would have the same bug as the original `alignof` * The original bug seems to be fixed but I'm not sure in which GCC version and I also don't know which minimal version of GCC needs to be supported by the arrow project If someone can confirm that it is ok to clean the code and use the same code unconditionally I'll update my changes. * GitHub Issue: #41536 Authored-by: Sylvain Joubert <[email protected]> Signed-off-by: Antoine Pitrou <[email protected]>
Issue resolved by pull request 45019 |
@sjoubert Can you post a message here so that we can assign this issue to you? |
Present! Thanks for merging the fix. |
Describe the bug, including details regarding any error messages, version, and platform.
Since it is in headers, it triggers when compiling user code with
-std=c++23
. Not a bug yet but it may be removed completely from C++26.Seen with clang++-18.
Component(s)
C++
The text was updated successfully, but these errors were encountered: