aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2024-05-13 12:52:28 +0100
committergingerBill <bill@gingerbill.org>2024-05-13 12:52:28 +0100
commit8d687a959d29c0ef0c631103b9775091e37c7e81 (patch)
treeef8918b3d576eac6e8d45b2c95b25b35c82c68ec /src/check_expr.cpp
parent8b4a8e4d806a9d8328c3aedf8175c681b42cb324 (diff)
Fix #3516
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp11
1 files changed, 11 insertions, 0 deletions
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;