diff options
author | Ian Lance Taylor <iant@golang.org> | 2019-09-06 18:12:46 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-09-06 18:12:46 +0000 |
commit | aa8901e9bb0399d2c16f988ba2fe46eb0c0c5d13 (patch) | |
tree | 7e63b06d1eec92beec6997c9d3ab47a5d6a835be /libgo/go/reflect/makefunc_ffi.go | |
parent | 920ea3b8ba3164b61ac9490dfdfceb6936eda6dd (diff) | |
download | gcc-aa8901e9bb0399d2c16f988ba2fe46eb0c0c5d13.zip gcc-aa8901e9bb0399d2c16f988ba2fe46eb0c0c5d13.tar.gz gcc-aa8901e9bb0399d2c16f988ba2fe46eb0c0c5d13.tar.bz2 |
libgo: update to Go 1.13beta1 release
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/193497
From-SVN: r275473
Diffstat (limited to 'libgo/go/reflect/makefunc_ffi.go')
-rw-r--r-- | libgo/go/reflect/makefunc_ffi.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libgo/go/reflect/makefunc_ffi.go b/libgo/go/reflect/makefunc_ffi.go index 9d9cbde..4564736 100644 --- a/libgo/go/reflect/makefunc_ffi.go +++ b/libgo/go/reflect/makefunc_ffi.go @@ -44,11 +44,6 @@ func FFICallbackGo(results unsafe.Pointer, params unsafe.Pointer, impl *makeFunc off := uintptr(0) for i, typ := range ftyp.out { v := out[i] - if v.typ != typ { - panic("reflect: function created by MakeFunc using " + funcName(impl.fn) + - " returned wrong type: have " + - out[i].typ.String() + " for " + typ.String()) - } if v.flag&flagRO != 0 { panic("reflect: function created by MakeFunc using " + funcName(impl.fn) + " returned value obtained from unexported field") @@ -56,6 +51,12 @@ func FFICallbackGo(results unsafe.Pointer, params unsafe.Pointer, impl *makeFunc off = align(off, uintptr(typ.fieldAlign)) addr := unsafe.Pointer(uintptr(results) + off) + + // Convert v to type typ if v is assignable to a variable + // of type t in the language spec. + // See issue 28761. + v = v.assignTo("reflect.MakeFunc", typ, addr) + if v.flag&flagIndir == 0 && (v.kind() == Ptr || v.kind() == UnsafePointer) { *(*unsafe.Pointer)(addr) = v.ptr } else { |