1
2
3
4
5
6
7
8
9
10 package main
11
12 import "fmt"
13
14 type T struct{}
15
16 func (T) M() {}
17
18 type M interface {
19 M()
20 }
21
22 var e interface{} = T{}
23 var i M = T{}
24 var b bool
25
26 func f1() int {
27 if b {
28 return f1()
29 }
30 z := 0x11223344
31 _ = e.(T)
32 return z
33 }
34
35 func f2() int {
36 if b {
37 return f1()
38 }
39 z := 0x11223344
40 _ = i.(T)
41 return z
42 }
43
44 func main() {
45 x := f1()
46 y := f2()
47 if x != 0x11223344 || y != 0x11223344 {
48 fmt.Printf("BUG: x=%#x y=%#x, want 0x11223344 for both\n", x, y)
49 }
50 }
51
View as plain text