build: fix unsafe.Sizeof for llgo:type C

This commit is contained in:
visualfc
2024-07-16 13:55:48 +08:00
parent 21a2f71ad9
commit 830c40440f
11 changed files with 283 additions and 168 deletions

30
cl/_testrt/unsafe/in.go Normal file
View File

@@ -0,0 +1,30 @@
package main
import (
"unsafe"
)
//llgo:type C
type T func()
type M struct {
v int
fn T
}
type N struct {
v int
fn func()
}
func main() {
if unsafe.Sizeof(*(*T)(nil)) != unsafe.Sizeof(0) {
panic("error")
}
if unsafe.Sizeof(*(*M)(nil)) != unsafe.Sizeof([2]int{}) {
panic("error")
}
if unsafe.Sizeof(*(*N)(nil)) != unsafe.Sizeof([3]int{}) {
panic("error")
}
}