Source file test/fixedbugs/issue9006.go
1 // run 2 3 // Copyright 2014 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 package main 8 9 type T1 struct { 10 X int 11 } 12 13 func NewT1(x int) T1 { return T1{x} } 14 15 type T2 int 16 17 func NewT2(x int) T2 { return T2(x) } 18 19 func main() { 20 switch (T1{}) { 21 case NewT1(1): 22 panic("bad1") 23 case NewT1(0): 24 // ok 25 default: 26 panic("bad2") 27 } 28 29 switch T2(0) { 30 case NewT2(2): 31 panic("bad3") 32 case NewT2(0): 33 // ok 34 default: 35 panic("bad4") 36 } 37 } 38