std::aligned_storage raises deprecation warning with the latest gcc 13 and C++23 (to be released in about 1 month and a half)
Romain-Geissler-1A opened this issue · 2 comments
Romain-Geissler-1A commented
Hi,
We try to compile a project which depends on boost::fiber, using a bleeding edge toolchain (ie using gcc 13 which will be released in 1 month and a half) and using C++23. In this version, libstdc++ has explicitly deprecated std::aligned_storage, as required by the standard.
I am not sure how you want to cope with this. You may:
- just ignore the deprecation (for now)
- somehow replace this by a union type having two member, one would be a single char, and another one would be the actual type you try to store.
- look at other replacements that either the standard or the folks in the C++ communitee recommand. For example one possible replacement using C++17's std::byte is being showed here (yet it still has the drawbacks of std::aligned_storage): https://stackoverflow.com/questions/71828288/why-is-stdaligned-storage-to-be-deprecated-in-c23-and-what-to-use-instead
Cheers,
Romain
Romain-Geissler-1A commented
Note: there is also boost::aligned_storage defined in boost/type_traits/aligned_storage.hpp
, yet I am not sure this is actually the direction the standard wanted you to follow when deprecating the std one !