Source file
test/abi/defer_recover_results.go
1
2
3
4
5
6
7
8
9
10
11 package main
12
13 type S struct {
14 x uint8
15 y uint16
16 z uint32
17 w float64
18 }
19
20 var a0, b0, c0, d0 = 10, "hello", S{1, 2, 3, 4}, [2]int{111, 222}
21
22
23
24 func F() (a int, b string, _ int, c S, d [2]int) {
25 a, b, c, d = a0, b0, c0, d0
26 defer func() { recover() }()
27 panic("XXX")
28 return
29 }
30
31 func main() {
32 a1, b1, zero, c1, d1 := F()
33 if a1 != a0 || b1 != b0 || c1 != c0 || d1 != d0 || zero != 0 {
34 panic("FAIL")
35 }
36 }
37
View as plain text