Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[release-branch.go1.3] runtime: fix defer of nil func
««« CL 105140044 / c2832405e9b9 runtime: fix defer of nil func Fixes #8047. LGTM=r, iant R=golang-codereviews, r, iant CC=dvyukov, golang-codereviews, khr https://golang.org/cl/105140044 »»» LGTM=r R=golang-codereviews, r CC=adg, golang-codereviews, iant https://golang.org/cl/103370044
- Loading branch information
Showing
2 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// run | ||
|
||
// Copyright 2014 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// Issue 8047. Defer setup during panic shouldn't crash for nil defer. | ||
|
||
package main | ||
|
||
func main() { | ||
defer func() { | ||
recover() | ||
}() | ||
f() | ||
} | ||
|
||
func f() { | ||
var g func() | ||
defer g() | ||
panic(1) | ||
} |