Commit 4b64c53c authored by David Crawshaw's avatar David Crawshaw

reflect: clear tflag for StructOf type

Fixes #15923

Change-Id: I3e56564365086ceb0bfc15db61db6fb446ab7448
Reviewed-on: https://go-review.googlesource.com/23760Reviewed-by: default avatarSebastien Binet <seb.binet@gmail.com>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent cf862478
......@@ -3934,6 +3934,10 @@ func TestStructOf(t *testing.T) {
if s != want {
t.Errorf("constructed struct = %s, want %s", s, want)
}
const stStr = `struct { S string "s"; X uint8 "x"; Y uint64; Z [3]uint16 }`
if got, want := st.String(), stStr; got != want {
t.Errorf("StructOf(fields).String()=%q, want %q", got, want)
}
// check the size, alignment and field offsets
stt := TypeOf(struct {
......
......@@ -2640,6 +2640,7 @@ func StructOf(fields []StructField) Type {
}
typ.str = resolveReflectName(newName(str, "", "", false))
typ.tflag = 0
typ.hash = hash
typ.size = size
typ.align = typalign
......
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