]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
common/static_ptr: pass an integer to alignas to fix GCC-11 build failure 64071/head
authorKefu Chai <tchaikov@gmail.com>
Fri, 20 Jun 2025 23:00:01 +0000 (07:00 +0800)
committerKefu Chai <tchaikov@gmail.com>
Fri, 20 Jun 2025 23:11:26 +0000 (07:11 +0800)
commite5d6aaf97bca184bf2cb8d3ac9039847ed03a62d
tree23601dfabb92e25c172fa4ebec2cbb9e8566a20d
parent6771fb55550be2d677fb708f510ce56ddf79c48e
common/static_ptr: pass an integer to alignas to fix GCC-11 build failure

GCC-11 fails to compile `alignas(std::bit_ceil(Size))` despite std::bit_ceil()
being marked constexpr in libstdc++11. The compiler doesn't recognize it as a
constant expression, while GCC-12+ and Clang-14+ handle it correctly.

Define the alignment value as a separate constexpr variable before passing it
to alignas() to ensure compatibility with GCC-11.

Fixes compilation issue introduced in commit 73399b05 when std::aligned_storage_t
was replaced with alignas.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/common/static_ptr.h