From e408010fa97917b25c94f8cfcac1380b4d386ebc Mon Sep 17 00:00:00 2001 From: Pavel Solodovnikov Date: Sat, 6 Jan 2024 22:38:12 +0300 Subject: [PATCH] objmem.h: Check return type of handler lambda in `mutating_list_iterate` Signed-off-by: Pavel Solodovnikov --- src/objmem.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/objmem.h b/src/objmem.h index f452e068925..614c8a3a646 100644 --- a/src/objmem.h +++ b/src/objmem.h @@ -29,6 +29,7 @@ #include #include #include +#include /* The lists of objects allocated */ template @@ -166,6 +167,9 @@ enum class IterationResult template void mutating_list_iterate(std::list& list, MaybeErasingLoopBodyHandler handler) { + static_assert(std::is_same, IterationResult>::value, + "Loop body handler should return IterationResult"); + typename std::remove_reference_t::iterator it = list.begin(), itNext; while (it != list.end()) {