package main import "unsafe" type T0 struct{ a int16 b float32 c string } type T1 struct{ d bool e complex128 f *T1 } type T2 struct{ g rune T0 *T1 } func main() { var x T2 println(unsafe.Offsetof(x.g)) // == 0 (correct) println(unsafe.Offsetof(x.T0)) // == 8 (correct) println(unsafe.Offsetof(x.a)) // == 0 (incorrect, expected 8) println(unsafe.Offsetof(x.d)) // == 0 (incorrect, should be illegal) println(uintptr(unsafe.Pointer(&x)) + unsafe.Offsetof(x.c) == uintptr(unsafe.Pointer(&x.c))) // == false (incorrect) }