diff --git a/src/compiler/sema_expr.c b/src/compiler/sema_expr.c index 9916d801a..9486bdfa7 100644 --- a/src/compiler/sema_expr.c +++ b/src/compiler/sema_expr.c @@ -4191,7 +4191,7 @@ static inline bool sema_expr_analyse_subscript_lvalue(SemaContext *context, Expr } default: DEFAULT: - if (!sema_analyse_expr_rvalue(context, subscripted)) return false; + if (!sema_analyse_expr(context, subscripted)) return false; break; } @@ -4226,8 +4226,6 @@ DEFAULT: return true; } - if (!sema_cast_rvalue(context, subscripted, true)) return false; - bool start_from_end = expr->subscript_expr.index.start_from_end; if (overload) { diff --git a/test/test_suite/contracts/out_array_in_struct.c3t b/test/test_suite/contracts/out_array_in_struct.c3t new file mode 100644 index 000000000..3946270ef --- /dev/null +++ b/test/test_suite/contracts/out_array_in_struct.c3t @@ -0,0 +1,13 @@ +struct Foo +{ + int[2] a; +} + +<* + @param [&out] bar +*> +fn void foo(Foo* bar) +{ + bar.a[0] = 0; +} +fn int main() => 0;