From e10257f86a5c7da7bcc3f7df2d876f4b7470ac52 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Wed, 25 Mar 2026 14:11:22 +0000 Subject: [PATCH] Fix slicing logic of a FCD array to check if it can be sliced or not --- src/check_expr.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 501d37e54..93836115a 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -11709,6 +11709,14 @@ gb_internal ExprKind check_slice_expr(CheckerContext *c, Operand *o, Ast *node, case Type_FixedCapacityDynamicArray: valid = true; + if (o->mode != Addressing_Variable && !is_type_pointer(o->type)) { + gbString str = expr_to_string(node); + error(node, "Cannot slice a fixed capacity dynamic array '%s', value is not addressable", str); + gb_string_free(str); + o->mode = Addressing_Invalid; + o->expr = node; + return kind; + } o->type = alloc_type_slice(t->FixedCapacityDynamicArray.elem); break;