diff --git a/src/mem/pool.h b/src/mem/pool.h index c57b525..f8245c5 100644 --- a/src/mem/pool.h +++ b/src/mem/pool.h @@ -49,17 +49,27 @@ namespace snmalloc * SFINAE helper. Matched only if `T` implements `ensure_init`. Calls it * if it exists. */ - SNMALLOC_FAST_PATH static auto call_ensure_init(SharedStateHandle*, int) - -> decltype(SharedStateHandle::ensure_init()) + template + SNMALLOC_FAST_PATH static auto call_ensure_init(SharedStateHandle_*, int) + -> decltype(SharedStateHandle_::ensure_init()) { - SharedStateHandle::ensure_init(); + static_assert( + std::is_same::value, + "SFINAE parameter, should only be used with SharedStateHandle"); + SharedStateHandle_::ensure_init(); } /** * SFINAE helper. Matched only if `T` does not implement `ensure_init`. * Does nothing if called. */ - SNMALLOC_FAST_PATH static auto call_ensure_init(SharedStateHandle*, long) {} + template + SNMALLOC_FAST_PATH static auto call_ensure_init(SharedStateHandle_*, long) + { + static_assert( + std::is_same::value, + "SFINAE parameter, should only be used with SharedStateHandle"); + } /** * Call `SharedStateHandle::ensure_init()` if it is implemented, do nothing @@ -67,7 +77,7 @@ namespace snmalloc */ SNMALLOC_FAST_PATH static void ensure_init() { - call_ensure_init(nullptr, 0); + call_ensure_init(nullptr, 0); } static void make_pool(PoolState*) noexcept