mirror of https://github.com/golang/go.git
reflect: fix Zero() implementation - not every type has a
zero object allocated, so we still need to allocate a new zero area every time. Fixes #6876. R=golang-dev CC=golang-dev https://golang.org/cl/36320043
This commit is contained in:
parent
85138da832
commit
e7d899cba5
|
|
@ -2175,7 +2175,7 @@ func Zero(typ Type) Value {
|
|||
if t.size <= ptrSize {
|
||||
return Value{t, nil, fl}
|
||||
}
|
||||
return Value{t, t.zero, fl | flagIndir}
|
||||
return Value{t, unsafe_New(typ.(*rtype)), fl | flagIndir}
|
||||
}
|
||||
|
||||
// New returns a Value representing a pointer to a new zero value
|
||||
|
|
|
|||
Loading…
Reference in New Issue