diff options
author | Russ Cox <rsc@golang.org> | 2014-06-12 16:34:36 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2014-06-12 16:34:36 -0400 |
commit | 9cd9737190e90ac51bd82311de18c49bcfad6f24 (patch) | |
tree | 8c757bf0ea88c62ea4b46a367a66530dea01832b /test/fixedbugs | |
parent | fb0be36e8e8ec536fd06e7af46b8cfafa6e37725 (diff) | |
download | go-9cd9737190e90ac51bd82311de18c49bcfad6f24.tar.gz |
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
Diffstat (limited to 'test/fixedbugs')
-rw-r--r-- | test/fixedbugs/issue8047b.go | 22 |
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) +} |