mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
reflect: add a test that gccgo mishandled
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
This commit is contained in:
parent
58d18e25af
commit
e59db90bfb
1 changed files with 9 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue