mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
reflect: clear tflag for StructOf type
Fixes #15923 Change-Id: I3e56564365086ceb0bfc15db61db6fb446ab7448 Reviewed-on: https://go-review.googlesource.com/23760 Reviewed-by: Sebastien Binet <seb.binet@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
cf862478c8
commit
4b64c53c03
2 changed files with 5 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue