Commit e7d899cb authored by Keith Randall's avatar Keith Randall

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
parent 85138da8
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment