added static_assert to prevent future misuse

This commit is contained in:
Valentin Balaschenko
2026-07-07 13:13:41 +01:00
parent 64f98327a4
commit 449624f910

View File

@@ -663,6 +663,9 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
{
static_assert(
!IsKeyCache, "fetchAndModify is only supported for value caches, not key-only caches");
static_assert(
std::is_same_v<Mutex, std::recursive_mutex>,
"fetchAndModify requires a recursive mutex because canonicalize re-acquires mutex_ internally");
std::scoped_lock const lock(mutex_);