]> Cypherpunks repositories - gostls13.git/commitdiff
reflect: add a test that gccgo mishandled
authorIan Lance Taylor <iant@golang.org>
Thu, 3 Oct 2013 20:23:02 +0000 (13:23 -0700)
committerIan Lance Taylor <iant@golang.org>
Thu, 3 Oct 2013 20:23:02 +0000 (13:23 -0700)
Failure occurred when using reflect.Call to pass a func value
following a non-pointer value.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/14186043

src/pkg/reflect/all_test.go

index a2f639fcc41ec5b6acf5660582e72247c367ca34..6e485c1e6b7027fb24d336a7b5ffc5cba293ddf8 100644 (file)
@@ -2479,6 +2479,15 @@ func TestVariadic(t *testing.T) {
        }
 }
 
+func TestFuncArg(t *testing.T) {
+       f1 := func(i int, f func(int) int) int { return f(i) }
+       f2 := func(i int) int { return i + 1 }
+       r := ValueOf(f1).Call([]Value{ValueOf(100), ValueOf(f2)})
+       if r[0].Int() != 101 {
+               t.Errorf("function returned %d, want 101", r[0].Int())
+       }
+}
+
 var tagGetTests = []struct {
        Tag   StructTag
        Key   string