Skip to content

std::aligned_storage is deprecated #49

@anders-wind

Description

@anders-wind

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions