1// run
2
3// Copyright 2021 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
7package main
8
9func main() {
10	if f() {
11		panic("FAIL")
12	}
13	if bad, _ := g(); bad {
14		panic("FAIL")
15	}
16	if bad, _ := h(); bad {
17		panic("FAIL")
18	}
19}
20
21func f() (bad bool) {
22	defer func() {
23		recover()
24	}()
25	var p *int
26	bad, _ = true, *p
27	return
28}
29
30func g() (bool, int) {
31	defer func() {
32		recover()
33	}()
34	var p *int
35	return true, *p
36}
37
38
39func h() (_ bool, _ int) {
40	defer func() {
41		recover()
42	}()
43	var p *int
44	return true, *p
45}
46