std::aligned_storage deprecated in C++23

Issue #541 new
Colin MacLean created an issue

C++23 deprecated std::aligned_storage: http://wg21.link/p1413. We make use of this in several places and these should be replaced with equivalent code that won’t trigger warnings once compilers implement p1413.

Comments (4)

  1. Dan Bonachea

    As of release 2022.9.0 std::aligned_storage has been removed from our training materials, and in many use cases replaced with std::optional.

    std::aligned_storage is still used in a few tests (for deprecated or undocumented serialization interfaces), and internally by a several library headers/modules (notably inside detail::raw_storage). We should eventually remove the remaining references (at least in C++23 mode) to avoid warnings and comply with the capricious whims of the C++ committee.

  2. Paul Hargrove

    Extracted from issue 606, which I've closed as a dup of this one:

    Testing of g++ 13.1.0 with -std=c++23 yields the following warnings (truncated for brevity) when compiling even a trivial application such as test/hello_upcxx.cpp:

    include/upcxx/future/core.hpp:388:43: warning: 'template<long unsigned int _Len, long unsigned int _Align> struct std::aligned_storage' is deprecated [-Wdeprecated-declarations]
    include/upcxx/serialization.hpp:1274:23: warning: 'template<long unsigned int _Len, long unsigned int _Align> struct std::aligned_storage' is deprecated [-Wdeprecated-declarations]
    include/upcxx/serialization.hpp:1767:23: warning: 'template<long unsigned int _Len, long unsigned int _Align> struct std::aligned_storage' is deprecated [-Wdeprecated-declarations]
    include/upcxx/utility.hpp:329:19: warning: 'template<long unsigned int _Len, long unsigned int _Align> struct std::aligned_storage' is deprecated [-Wdeprecated-declarations]
    include/upcxx/utility.hpp:379:19: warning: 'template<long unsigned int _Len, long unsigned int _Align> struct std::aligned_storage' is deprecated [-Wdeprecated-declarations]
    
  3. Log in to comment