Files
c3c/test/unit/regression/lvalue_handling.c3
Christoffer Lerno 8b49e6c14d Rename def to alias.
2025-03-13 11:22:27 +01:00

21 lines
295 B
Plaintext

module lvalue_handling;
import std;
struct Foo
{
int a;
}
alias 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);
}