Source file src/cmd/link/internal/ld/testdata/deadcode/reflectcall.go

     1  // Copyright 2020 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  // This example uses reflect.Value.Call, but not
     6  // reflect.{Value,Type}.Method. This should not
     7  // need to bring all methods live.
     8  
     9  package main
    10  
    11  import "reflect"
    12  
    13  func f() { println("call") }
    14  
    15  type T int
    16  
    17  func (T) M() {}
    18  
    19  func main() {
    20  	v := reflect.ValueOf(f)
    21  	v.Call(nil)
    22  	i := interface{}(T(1))
    23  	println(i)
    24  }
    25  

View as plain text