Closed
Description
What version of Go are you using (go version
)?
$ go version go version go1.20 windows/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env ... set GOARCH=amd64 ... set GOHOSTARCH=amd64 set GOHOSTOS=windows ... set GOOS=windows ...
What did you do?
package main
import (
"fmt"
"unsafe"
)
type s1 struct {
a uint16
}
type s2 struct {
a uint16
_ [0]int16
}
func main() {
fmt.Println(unsafe.Sizeof(s1{}))
fmt.Println(unsafe.Sizeof(s2{}))
}
What did you expect to see?
2
2
What did you see instead?
2
4