summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-06-12 16:55:24 -0400
committerRuss Cox <rsc@golang.org>2014-06-12 16:55:24 -0400
commit84dd645ab3c9b914f7a8dea1e817f0cc65f34a51 (patch)
tree42eeab4997deb5ad116219a24accd4188c7c1ce2 /test
parent2554629079b59e652c81b46d6f610ac5728d116e (diff)
downloadgo-84dd645ab3c9b914f7a8dea1e817f0cc65f34a51.tar.gz
[release-branch.go1.3] runtime: fix defer of nil func
??? CL 105140044 / c2832405e9b9 runtime: fix defer of nil func Fixes issue 8047. LGTM=r, iant R=golang-codereviews, r, iant CC=dvyukov, golang-codereviews, khr https://codereview.appspot.com/105140044 ??? LGTM=r R=golang-codereviews, r CC=adg, golang-codereviews, iant https://codereview.appspot.com/103370044
Diffstat (limited to 'test')
-rw-r--r--test/fixedbugs/issue8047b.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/fixedbugs/issue8047b.go b/test/fixedbugs/issue8047b.go
new file mode 100644
index 000000000..de6acaab5
--- /dev/null
+++ b/test/fixedbugs/issue8047b.go
@@ -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)
+}