ReactiveX / RxCpp

Reactive Extensions for C++
Apache License 2.0
3.07k stars 396 forks source link

`std::aligned_storage` is deprecated in C++23 #586

Open StephanTLavavej opened 2 years ago

StephanTLavavej commented 2 years ago

I work on MSVC's C++ Standard Library, where we've recently implemented a C++23 paper that affects your project. (We regularly build many open-source projects to prevent compiler/library regressions, and this also allows us to notify projects of breaking changes that will affect them.)

The C++23 paper is https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1413r3.pdf "Deprecate std::aligned_storage and std::aligned_union". We've merged a PR (https://github.com/microsoft/STL/pull/2583 ) that makes aligned_storage, aligned_storage_t, aligned_union, and aligned_union_t emit deprecation warnings when compiled in C++23 mode (/std:c++latest). This will be available in VS 2022 17.3 Preview 3. Although your project might not use /std:c++latest right now, we run such test coverage to identify issues that you might encounter in the future.

I searched and one line of affected code appears to be (there may be more):

https://github.com/ReactiveX/RxCpp/blob/761b932a80e2be6e2b62d232e754bd96fc448946/Rx/v2/src/rxcpp/rx-util.hpp#L572

In general, the recommended replacement is to use the alignas keyword. We do provide an "escape hatch" macro to silence the deprecation warning, if necessary.