R1 :: struct {
_: u16,
_: int,
i: int,
}
R2 :: struct {
_: u16,
r: R1,
_: int,
}
main :: proc() {
r2: R2
fmt.println(offset_of(R2{}.r.i)) // 16, wrongly assumes offset_of(R1, i)
fmt.println(offset_of(R2, r) + offset_of(R1, i)) // 24, right
fmt.println(uintptr(&r2.r.i) - uintptr(&r2)) // // 24, right
}
A fix could imply viability of the offset_of(R2, r.i)/offset_of(R2, "r.i") feature as well.