Source file test/typeparam/issue49309.go

     1  // run
     2  
     3  // Copyright 2021 The Go Authors. All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     6  
     7  package main
     8  
     9  func genfunc[T any](f func(c T)) {
    10  	var r T
    11  
    12  	f(r)
    13  }
    14  
    15  func myfunc(c string) {
    16  	test2(c)
    17  }
    18  
    19  //go:noinline
    20  func test2(a interface{}) {
    21  	_ = a.(string)
    22  }
    23  
    24  func main() {
    25  	genfunc(myfunc)
    26  }
    27  

View as plain text