Skip to content
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

std::aligned_storage is deprecated #49

Open
anders-wind opened this issue Apr 30, 2024 · 2 comments
Open

std::aligned_storage is deprecated #49

anders-wind opened this issue Apr 30, 2024 · 2 comments

Comments

@anders-wind
Copy link

anders-wind commented Apr 30, 2024

In c++23, std::aligned_storage is being deprecated (The proposed alternative is to use std::array<std::byte>). This causes compiler errors with for example clang-17 or 18 with c++23 flags see below.

...
[build] build/vcpkg_installed/x64-linux/include/rigtorp/MPMCQueue.h:108:17: error: 'aligned_storage<4, 4>' is deprecated [-Werror,-Wdeprecated-declarations]
[build]   108 |   typename std::aligned_storage<sizeof(T), alignof(T)>::type storage;
[build]       |                 ^
[build] /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/allocator.h:193:38: note: in instantiation of template class 'rigtorp::mpmc::Slot<int>' requested here
[build]   193 |             if (__builtin_mul_overflow(__n, sizeof(_Tp), &__n))
[build]       |                                             ^
[build] build/vcpkg_installed/x64-linux/include/rigtorp/MPMCQueue.h:129:25: note: in instantiation of member function 'std::allocator<rigtorp::mpmc::Slot<int>>::allocate' requested here
[build]   129 |     slots_ = allocator_.allocate(capacity_ + 1);
[build]       |                         ^
[build] utilities/include/utilities/parallel_helpers.h:28:18: note: in instantiation of member function 'rigtorp::mpmc::Queue<int>::Queue' requested here
[build]    28 |     auto tasks = rigtorp::MPMCQueue<TaskArgT>(n_tasks);
[build]       |                  ^
...
[build] 1 error generated.

We are getting MPMCqueue with the newest release of vcpkg. To work around this, we just add warning suppressions around it, but getting a real fix for this would be nice.

@anders-wind anders-wind changed the title aligned_storage is deprecated std::aligned_storage is deprecated Apr 30, 2024
@brmarkus
Copy link

Does "compiling with clang-18 or 17" mean you are compiling with "C++23"?
(found e.g. this "https://stackoverflow.com/questions/71828288/why-is-stdaligned-storage-to-be-deprecated-in-c23-and-what-to-use-instead")

@anders-wind
Copy link
Author

anders-wind commented Apr 30, 2024

Does "compiling with clang-18 or 17" mean you are compiling with "C++23"?
(found e.g. this "https://stackoverflow.com/questions/71828288/why-is-stdaligned-storage-to-be-deprecated-in-c23-and-what-to-use-instead")

Yes we are running with c++23 flags, so yes the deprecation of std::alligned_storage in c++ 23 is the causing issue, not clang-18 or 17 per se. I just wanted to include the information.

Ill improve the wording of the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants