mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Regression: "'out' parameters may not be read" when writing to array #2852
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
13
test/test_suite/contracts/out_array_in_struct.c3t
Normal file
13
test/test_suite/contracts/out_array_in_struct.c3t
Normal 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;
|
||||
Reference in New Issue
Block a user