Source file
test/fixedbugs/issue73920.go
1
2
3
4
5
6
7 package main
8
9 func callRecover() {
10 if recover() != nil {
11 println("recovered")
12 }
13 }
14
15 type T int
16
17 func (*T) M() { callRecover() }
18
19 type S struct{ *T }
20
21 var p = &S{new(T)}
22
23 var fn = (*S).M
24
25 func main() {
26 mustPanic(func() {
27 defer fn(p)
28 panic("XXX")
29 })
30 }
31
32 func mustPanic(f func()) {
33 defer func() {
34 r := recover()
35 if r == nil {
36 panic("didn't panic")
37 }
38 }()
39 f()
40 }
41
View as plain text