Skip to content

Commit b7b7b4d

Browse files
committed
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 17f888c commit b7b7b4d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/reflect/type.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2639,6 +2639,7 @@ func StructOf(fields []StructField) Type {
26392639
typ.tflag = 0
26402640
typ.hash = hash
26412641
typ.size = size
2642+
typ.ptrdata = typeptrdata(typ.common())
26422643
typ.align = typalign
26432644
typ.fieldAlign = typalign
26442645
typ.ptrToThis = 0
@@ -2709,7 +2710,6 @@ func StructOf(fields []StructField) Type {
27092710
typ.gcdata = &bv.data[0]
27102711
}
27112712
}
2712-
typ.ptrdata = typeptrdata(typ.common())
27132713
typ.alg = new(typeAlg)
27142714
if hashable {
27152715
typ.alg.hash = func(p unsafe.Pointer, seed uintptr) uintptr {

0 commit comments

Comments
 (0)