Files
lib_compiler/tests/field_access.txt
2024-04-13 15:29:53 +02:00

37 lines
423 B
Plaintext

import "libc";
T :: struct {
a: int;
t2: T2;
}
T2 :: struct {
b: int;
}
T3 :: struct {
om: T;
}
main :: proc(): int {
t: T;
a := t.a; @unused
b := (t).a; @unused
i0 := :T{10}.a;
i1 := :T{}.t2.b;
i2 := :T{t2={1}}.t2;
assert(i0 == 10);
assert(i1 == 0);
assert(i2.b == 1);
assert(t.t2.b == 0);
i3: T3;
i3.om.a = 10;
i3.om.t2.b = 10;
return 0;
}