From 8d687a959d29c0ef0c631103b9775091e37c7e81 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 13 May 2024 12:52:28 +0100 Subject: Fix #3516 --- src/check_expr.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/check_expr.cpp') diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 1fc6eeb52..6a293a97e 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -10263,6 +10263,17 @@ gb_internal ExprKind check_slice_expr(CheckerContext *c, Operand *o, Ast *node, case Type_Struct: if (is_type_soa_struct(t)) { valid = true; + if (t->Struct.soa_kind == StructSoa_Fixed) { + max_count = t->Struct.soa_count; + if (o->mode != Addressing_Variable && !is_type_pointer(o->type)) { + gbString str = expr_to_string(node); + error(node, "Cannot slice #soa array '%s', value is not addressable", str); + gb_string_free(str); + o->mode = Addressing_Invalid; + o->expr = node; + return kind; + } + } o->type = make_soa_struct_slice(c, nullptr, nullptr, t->Struct.soa_elem); } break; -- cgit v1.2.3