Regression: "'out' parameters may not be read" when writing to array #2852

This commit is contained in:
Christoffer Lerno
2026-01-27 13:48:50 +01:00
parent 4fbb42833e
commit f3ede27f60
2 changed files with 14 additions and 3 deletions

View File

@@ -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)
{

View File

@@ -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;