Closed
Description
package p
type A [1]int
func bad(x A) {
switch x {
case A([1]int{1}):
case A([1]int{1}):
}
}
func good(x A) {
y := A([1]int{1})
z := A([1]int{1})
switch x {
case y:
case z:
}
}
Compiling this code generates:
x.go:7: cannot use &statictmp_1 (type *[1]int) as type *A in assignment
x.go:8: cannot use &statictmp_4 (type *[1]int) as type *A in assignment
Observe that func good is more or less equivalent to func bad, but it compiles. The reported types in the error message are also wrong: x is an A, not a *A.
Reproduces in 1.4, 1.5, and 1.6, so setting milestone to 1.8.