Source file src/cmd/link/internal/ld/testdata/deadcode/methexpr_method.go
1 // Copyright 2026 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // reflect.Value.Method used as a function value must keep all exported 6 // methods, like a direct call with a non-constant index does. 7 8 package main 9 10 import ( 11 "os" 12 "reflect" 13 ) 14 15 type T int 16 17 func (T) M() {} 18 19 func main() { 20 f := reflect.Value.Method 21 f(reflect.ValueOf(T(1)), len(os.Args)-1).Call(nil) 22 } 23