1
0
mirror of https://github.com/golang/go synced 2024-11-21 11:14:40 -07:00

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
This commit is contained in:
Ian Lance Taylor 2012-03-01 08:24:03 -08:00
parent d88af88dfb
commit b14a6643dc

View File

@ -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()
}
}