]> Cypherpunks.ru repositories - gostls13.git/blob - test/fixedbugs/issue43835.go
[dev.regabi] all: merge master (bf0f7c9) into dev.regabi
[gostls13.git] / test / fixedbugs / issue43835.go
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
7 package main
8
9 func 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
21 func f() (bad bool) {
22         defer func() {
23                 recover()
24         }()
25         var p *int
26         bad, _ = true, *p
27         return
28 }
29
30 func g() (bool, int) {
31         defer func() {
32                 recover()
33         }()
34         var p *int
35         return true, *p
36 }
37
38
39 func h() (_ bool, _ int) {
40         defer func() {
41                 recover()
42         }()
43         var p *int
44         return true, *p
45 }