aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/reflect/value.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/reflect/value.go')
-rw-r--r--src/reflect/value.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/reflect/value.go b/src/reflect/value.go
index 15a900f9e..d1f8cb2f7 100644
--- a/src/reflect/value.go
+++ b/src/reflect/value.go
@@ -1479,7 +1479,8 @@ func MakeSlice(typ Type, len, cap int) Value {
ulen := uint(len)
ucap := uint(cap)
maxSize := (^uintptr(0)) / 2
- elementSize := rtype.elem().Size()
+ elem := rtype.elem()
+ elementSize := elem.Size()
if elementSize > 1 {
maxSize /= uintptr(elementSize)
}
@@ -1493,7 +1494,9 @@ func MakeSlice(typ Type, len, cap int) Value {
var slice sliceHeader
slice.cap = uintptr(ucap)
slice.len = uintptr(ulen)
- slice.data = alloc(size, nil)
+ layout := elem.gcLayout()
+
+ slice.data = alloc(size, layout)
return Value{
typecode: rtype,