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
7package main
8
9type T1 struct {
10	X int
11}
12
13func NewT1(x int) T1 { return T1{x} }
14
15type T2 int
16
17func NewT2(x int) T2 { return T2(x) }
18
19func 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