Commit b7b7b4d6 authored by Keith Randall's avatar Keith Randall Committed by Keith Randall

reflect: initialize ptrdata earlier in StructOf

It needs to be set before addTypeBits is called.

Fixes #31043

Change-Id: I692b4047dc17bd68202d45da41dd55d432383e59
Reviewed-on: https://go-review.googlesource.com/c/go/+/169318
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 17f888c5
...@@ -2639,6 +2639,7 @@ func StructOf(fields []StructField) Type { ...@@ -2639,6 +2639,7 @@ func StructOf(fields []StructField) Type {
typ.tflag = 0 typ.tflag = 0
typ.hash = hash typ.hash = hash
typ.size = size typ.size = size
typ.ptrdata = typeptrdata(typ.common())
typ.align = typalign typ.align = typalign
typ.fieldAlign = typalign typ.fieldAlign = typalign
typ.ptrToThis = 0 typ.ptrToThis = 0
...@@ -2709,7 +2710,6 @@ func StructOf(fields []StructField) Type { ...@@ -2709,7 +2710,6 @@ func StructOf(fields []StructField) Type {
typ.gcdata = &bv.data[0] typ.gcdata = &bv.data[0]
} }
} }
typ.ptrdata = typeptrdata(typ.common())
typ.alg = new(typeAlg) typ.alg = new(typeAlg)
if hashable { if hashable {
typ.alg.hash = func(p unsafe.Pointer, seed uintptr) uintptr { typ.alg.hash = func(p unsafe.Pointer, seed uintptr) uintptr {
......
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