test/fixedbugs/issue15895.go
raw| 1 | // compile |
| 2 | |
| 3 | // Copyright 2016 The Go Authors. All rights reserved. |
| 4 | // Use of this source code is governed by a BSD-style |
| 5 | // license that can be found in the LICENSE file. |
| 6 | |
| 7 | // func bad used to fail to compile. |
| 8 | |
| 9 | package p |
| 10 | |
| 11 | type A [1]int |
| 12 | |
| 13 | func bad(x A) { |
| 14 | switch x { |
| 15 | case A([1]int{1}): |
| 16 | case A([1]int{1}): |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | func good(x A) { |
| 21 | y := A([1]int{1}) |
| 22 | z := A([1]int{1}) |
| 23 | switch x { |
| 24 | case y: |
| 25 | case z: |
| 26 | } |
| 27 | } |