-
Notifications
You must be signed in to change notification settings - Fork 758
std::aligned_storage is deprecated as of C++23 #1908
std::aligned_storage is deprecated as of C++23 #1908
Conversation
Can one of the admins verify this patch? Admins can comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am decidedly not happy with this patch. std::aligned_storage
has been deprecated for a reason. It does not serve any purpose anymore and is both easy to miss-use and hard to use. Any use of std::aligned_storage
is better replaced by
alignas(T) std::byte buffer[sizeof(T)];
So the proper solution to the deprecation of std::aligned_storage
is to stop using it. Note that depending on your standard library you can always simply silence the deprecation warning.
I am strongly leaning towards closing this but will wait for another maintainers opinion
If you prefer a different approach such as eliminating entirely, I’d be happy to redo the PR. |
My preferred solution would be to do nothing. A user can properly fix their code or add a compiler flag. There is no useful action on our side as the issue is not that we are using deprecated facilities, but that the whole feature is deprecated |
I'm confused now: doing nothing means using a deprecated feature and Thrust triggering warnings by default. There's nothing in user code triggering said warnings, other than including a Thrust header. Is the solution you prefer really to have users enable flags to suppress warnings for code that will presumably become an error when this feature is eventually removed from the standard? As you say the whole feature is deprecated why not eliminate it, both the C++11 and fallback version, from Thrust? |
…ggering warnings in user code
I just verified that eliminating all implementations of
I also eliminated the corresponding tests. I'm not able to push this morning, but I will try pushing again later. |
4b92de3
to
06cbce4
Compare
@allisonvacanti would you mind taking a look at this as well? I'm curious if you have any feedback. To summarize the above: Compiling Thrust code using C++23 currently triggers warnings (or errors if compiled with |
Hi @andrewcorrigan I am closing this in favor of NVIDIA/cccl#258 as we have moved our repositories to a unified monorepo I have adopted your changes, to simply ignore the deprecation warning for now. That does not break users which require It would be awesome if you could test whether this works for your project |
std::aligned_storage
is deprecated as of C++23. Compiling withgcc-13
and-std=c++2b
, I get warnings like,from innocuous code that simply include a Thrust header file
Updated Approach
This PR now proposes to eliminate
thrust::detail::aligned_storage
and the associated tests.Original Approach
I first tried a surgical change like the following
but the warning persisted.
Therefore, the proposed resolution in this PR simply deletes the
THRUST_CPP_DIALECT >= 2011
implementation:unconditionally switching back to the pre-C++11 implementation.