mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-04 02:57:46 +00:00
compiler: fix unsafe.Sizeof for chan and map values
These types are simply pointers. For some reason, they were never implemented. Fixes https://github.com/tinygo-org/tinygo/issues/3083.
This commit is contained in:
Vendored
+2
@@ -175,6 +175,8 @@ func main() {
|
||||
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()")
|
||||
assertSize(reflect.TypeOf(zeroChan).Size() == unsafe.Sizeof(zeroChan), "chan int")
|
||||
assertSize(reflect.TypeOf(zeroMap).Size() == unsafe.Sizeof(zeroMap), "map[string]int")
|
||||
|
||||
// make sure embedding a zero-sized "not comparable" struct does not add size to a struct
|
||||
assertSize(reflect.TypeOf(doNotCompare{}).Size() == unsafe.Sizeof(doNotCompare{}), "[0]func()")
|
||||
|
||||
Reference in New Issue
Block a user