mirror of
https://github.com/odin-lang/Odin.git
synced 2026-08-26 15:01:31 +00:00
fixes range loop over array elements in soa containers
This commit is contained in:
@@ -1883,7 +1883,12 @@ 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_ptr;
|
||||
// for #soa container with array element type, the element carries Addressing_SoaVariable,
|
||||
// rather than Addressing_Variable; the element itself has no address,
|
||||
// but each component does, so for &v in soa[i] is addressable
|
||||
is_possibly_addressable = operand.mode == Addressing_Variable ||
|
||||
operand.mode == Addressing_SoaVariable ||
|
||||
is_ptr;
|
||||
array_add(&vals, t->Array.elem);
|
||||
array_add(&vals, t_int);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user