From 32322f7cabcc0470945d64198f566721871214e4 Mon Sep 17 00:00:00 2001 From: harleywilsoneng Date: Sun, 16 Aug 2026 14:00:31 +0800 Subject: [PATCH] fix: make power_of_two max_bucket_count static constexpr (#93) Signed-off-by: harleywilsoneng --- include/tsl/robin_growth_policy.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/tsl/robin_growth_policy.h b/include/tsl/robin_growth_policy.h index 9abba3b..2cdb6cb 100644 --- a/include/tsl/robin_growth_policy.h +++ b/include/tsl/robin_growth_policy.h @@ -139,8 +139,12 @@ class power_of_two_growth_policy { /** * Return the maximum number of buckets supported by the policy. + * + * Static: does not depend on instance state. Calling the non-static form + * from the constructor made GCC 16 emit -Wmaybe-uninitialized on the + * implicit this pointer (see Tessil/robin-map#93). */ - std::size_t max_bucket_count() const { + static constexpr std::size_t max_bucket_count() noexcept { // Largest power of two. return (std::numeric_limits::max() / 2) + 1; }