package p
func f() {
var b [0]struct{}
_ = b[2:]
}
gotype says:
x.go:5:8: index 2 (constant of type int) is out of bounds
cmd/compile gives no error. If you change b's type to [1]struct{}, the error from cmd/compile is:
x.go:5: invalid slice index 2 (out of bounds for 1-element array)
Reproduces with (at least) 1.7 and 1.8 and 1.9beta1.
gotype says:
cmd/compile gives no error. If you change b's type to
[1]struct{}, the error from cmd/compile is:Reproduces with (at least) 1.7 and 1.8 and 1.9beta1.