reflect: implement Sizeof and Alignof for func values

This is a small change that appears to be necessary for encoding/json
support. It's simple enough to implement.
This commit is contained in:
Ayke van Laethem
2021-03-28 22:31:27 +02:00
committed by Ron Evans
parent 16e7dd83a3
commit 4f6d598ea8
3 changed files with 14 additions and 4 deletions
+1
View File
@@ -148,6 +148,7 @@ func main() {
assertSize(reflect.TypeOf(uintptr(0)).Size() == unsafe.Sizeof(uintptr(0)), "uintptr")
assertSize(reflect.TypeOf("").Size() == unsafe.Sizeof(""), "string")
assertSize(reflect.TypeOf(new(int)).Size() == unsafe.Sizeof(new(int)), "*int")
assertSize(reflect.TypeOf(zeroFunc).Size() == unsafe.Sizeof(zeroFunc), "func()")
// SetBool
rv := reflect.ValueOf(new(bool)).Elem()