Files
c3c/test/unit/regression/lvalue_handling.c3
2025-03-03 00:32:20 +01:00

21 lines
293 B
Plaintext

module lvalue_handling;
import std;
struct Foo
{
int a;
}
def IntList = List{Foo};
fn void subscript_overload() @test
{
IntList x;
defer x.free();
x.push({ 3 });
int* a = &x[0].a;
assert(*a == 3);
assert(x[0].a == 3);
*a = 4;
assert(x[0].a == 4);
x[0].a = 5;
assert(x[0].a == 5);
}