diff options
author | Ian Lance Taylor <iant@golang.org> | 2012-03-01 08:24:03 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2012-03-01 08:24:03 -0800 |
commit | b14a6643dc47104689facd938a0fb254996ddf85 (patch) | |
tree | 4673b0d5774f92858450685acbe4c2a944a6f34e /test/recover.go | |
parent | d88af88dfbd5b7a84ac3adbae6c714d644d72398 (diff) | |
download | go-b14a6643dc47104689facd938a0fb254996ddf85.tar.gz go-b14a6643dc47104689facd938a0fb254996ddf85.zip |
test: add test of calling recover in a varargs function
gccgo did not handle this correctly.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5714050
Diffstat (limited to 'test/recover.go')
-rw-r--r-- | test/recover.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/recover.go b/test/recover.go index d32cfdf3d1..eea655ec57 100644 --- a/test/recover.go +++ b/test/recover.go @@ -244,3 +244,30 @@ func test7() { die() } } + +func varargs(s *int, a ...int) { + *s = 0 + for _, v := range a { + *s += v + } + if recover() != nil { + *s += 100 + } +} + +func test8a() (r int) { + defer varargs(&r, 1, 2, 3) + panic(0) +} + +func test8b() (r int) { + defer varargs(&r, 4, 5, 6) + return +} + +func test8() { + if test8a() != 106 || test8b() != 15 { + println("wrong value") + die() + } +} |