From b4d8b074cb090892b7235ae86bd07fd11a43ff05 Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Fri, 2 Oct 2026 18:38:50 +0200 Subject: [PATCH] newcelltypes: check cell count sufficient --- kernel/newcelltypes.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/newcelltypes.h b/kernel/newcelltypes.h index 826cadd1a..e61292be7 100644 --- a/kernel/newcelltypes.h +++ b/kernel/newcelltypes.h @@ -455,8 +455,11 @@ struct Categories { } constexpr void set_id(IdString type, bool val = true) { size_t idx = type.raw(); - if (idx >= MAX_CELLS) - return; // TODO should be an assert but then it's not constexpr + if (idx >= MAX_CELLS) { + if (std::is_constant_evaluated()) + throw "cell type index out of range"; + log_abort(); + } data[idx] = val; } constexpr void set(size_t idx, bool val = true) {