aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2024-05-20 13:36:32 +0100
committergingerBill <bill@gingerbill.org>2024-05-20 13:36:32 +0100
commit46b3e7b6fa9477b7feb4389a353f92c7cc4c3d20 (patch)
treea789161e4a5b5d388bcf02ef6a82244dc5ebe97c /src
parenta80011c830d52874157e1ed9a43b2561460b4bbe (diff)
Fix `for &v in &fixed_array`
Diffstat (limited to 'src')
-rw-r--r--src/check_stmt.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp
index 23a97696d..2083dbf11 100644
--- a/src/check_stmt.cpp
+++ b/src/check_stmt.cpp
@@ -1663,6 +1663,7 @@ gb_internal void check_range_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags)
}
}
}
+ bool is_ptr = type_deref(operand.type);
Type *t = base_type(type_deref(operand.type));
switch (t->kind) {
@@ -1707,7 +1708,7 @@ gb_internal void check_range_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags)
break;
case Type_Array:
- is_possibly_addressable = operand.mode == Addressing_Variable;
+ is_possibly_addressable = operand.mode == Addressing_Variable || is_ptr;
array_add(&vals, t->Array.elem);
array_add(&vals, t_int);
break;