reflect: test name data is aligned

For #14962.

Change-Id: I3539d882487c99dee99ac953e039b79c6b963cf9
Reviewed-on: https://go-review.googlesource.com/21150
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
David Crawshaw 2016-03-25 14:28:15 -04:00
parent edb19aa1cd
commit 640164bc1c
2 changed files with 37 additions and 0 deletions

View file

@ -5065,3 +5065,16 @@ func TestNames(t *testing.T) {
}
}
}
type embed struct {
EmbedWithUnexpMeth
}
func TestNameBytesAreAligned(t *testing.T) {
typ := TypeOf(embed{})
b := FirstMethodNameBytes(typ)
v := uintptr(unsafe.Pointer(b))
if v%unsafe.Alignof((*byte)(nil)) != 0 {
t.Errorf("reflect.name.bytes pointer is not aligned: %x", v)
}
}