Source file
test/fixedbugs/issue53702.go
1
2
3
4
5
6
7 package main
8
9 type Elem struct{}
10
11 func (*Elem) Wait(callback func()) {}
12
13 type Base struct {
14 elem [8]*Elem
15 }
16
17 var g_val = 1
18
19 func (s *Base) Do() *int {
20 resp := &g_val
21 for _, e := range s.elem {
22 e.Wait(func() {
23 *resp = 0
24 })
25 }
26 return resp
27 }
28
29 type Sub struct {
30 *Base
31 }
32
33 func main() {
34 a := Sub{new(Base)}
35 resp := a.Do()
36 if resp != nil && *resp != 1 {
37 panic("FAIL")
38 }
39 }
40
View as plain text