Source file test/fixedbugs/issue73916.go
1 // run 2 3 // Copyright 2025 The Go Authors. All rights reserved. 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file. 6 7 package main 8 9 func callRecover() { 10 if recover() != nil { 11 println("recovered") 12 } 13 } 14 15 func F(int) { callRecover() } 16 17 func main() { 18 mustPanic(func() { 19 defer F(1) 20 panic("XXX") 21 }) 22 } 23 24 func mustPanic(f func()) { 25 defer func() { 26 r := recover() 27 if r == nil { 28 panic("didn't panic") 29 } 30 }() 31 f() 32 } 33