diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 309e46313..981ef8684 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -3934,6 +3934,11 @@ gb_internal void check_cast(CheckerContext *c, Operand *x, Type *type, bool forb } } + // In this case, the cast involves array programming + // so the operand needs to be a computed value + if (!is_type_array_like(x->type) && is_type_array_like(type)) { + x->mode = Addressing_Value; + } x->type = type; }