mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
reflect: fix methodValueCall code pointer mismatch in Value.Pointer
This is the port of CL 356809 for Value.Pointer to fix the mismatch of methodValueCall code pointer. Change-Id: I080ac41b94b44d878cd5896207a76a28c57fd48b Reviewed-on: https://go-review.googlesource.com/c/go/+/356950 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
d7149e502d
commit
07e5527249
2 changed files with 6 additions and 4 deletions
|
|
@ -7724,9 +7724,12 @@ func TestNotInHeapDeref(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestMethodCallValueCodePtr(t *testing.T) {
|
||||
p := ValueOf(Point{}).Method(1).UnsafePointer()
|
||||
m := ValueOf(Point{}).Method(1)
|
||||
want := MethodValueCallCodePtr()
|
||||
if got := uintptr(p); got != want {
|
||||
if got := uintptr(m.UnsafePointer()); got != want {
|
||||
t.Errorf("methodValueCall code pointer mismatched, want: %v, got: %v", want, got)
|
||||
}
|
||||
if got := m.Pointer(); got != want {
|
||||
t.Errorf("methodValueCall code pointer mismatched, want: %v, got: %v", want, got)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue