mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-07 20:43:40 +00:00
reflect: fix reflect.TyepAssert for structs
This commit is contained in:
committed by
deadprogram
parent
d04332d688
commit
b29edadf48
@@ -138,7 +138,7 @@ func TypeAssert[T any](v Value) (T, bool) {
|
||||
var zero T
|
||||
return zero, false
|
||||
}
|
||||
if !v.isIndirect() {
|
||||
if !v.isIndirect() && v.typecode.Size() <= unsafe.Sizeof(uintptr(0)) {
|
||||
return *(*T)(unsafe.Pointer(&v.value)), true
|
||||
}
|
||||
return *(*T)(v.value), true
|
||||
|
||||
Reference in New Issue
Block a user