mirror of
https://github.com/golang/go
synced 2024-11-22 06:34:40 -07:00
283d8a3d53
Updates #47651 Updates #48665 Change-Id: I69a87b45a5cad7a07fbd855040cd9935cf874554 Reviewed-on: https://go-review.googlesource.com/c/go/+/358454 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: Brad Fitzpatrick <bradfitz@golang.org>
25 lines
421 B
Go
25 lines
421 B
Go
// run
|
|
|
|
// Copyright 2021 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// See issue 44207.
|
|
|
|
package main
|
|
|
|
import "reflect"
|
|
|
|
type S int
|
|
|
|
func (s S) M() {}
|
|
|
|
func main() {
|
|
t := reflect.TypeOf(S(0))
|
|
fn, ok := reflect.PointerTo(t).MethodByName("M")
|
|
if !ok {
|
|
panic("FAIL")
|
|
}
|
|
fn.Func.Call([]reflect.Value{reflect.New(t)})
|
|
}
|