1
2
3
4
5
6
7
8
9
10
11 package main
12
13 func f1() {
14 type T [2]int
15 p := T{0, 1}
16 switch p {
17 case T{0, 0}:
18 panic("wrong1")
19 case T{0, 1}:
20
21 default:
22 panic("wrong2")
23 }
24
25 if p == (T{0, 0}) {
26 panic("wrong3")
27 } else if p == (T{0, 1}) {
28
29 } else {
30 panic("wrong4")
31 }
32 }
33
34 type T struct {
35 V int
36 }
37
38 var X = T{}.V
39
40 func f2() {
41 var x = T{}.V
42 if x != 0 {
43 panic("wrongx")
44 }
45 if X != 0 {
46 panic("wrongX")
47 }
48 }
49
50 func main() {
51 f1()
52 f2()
53 }
54
View as plain text