modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/fixedbugs/issue6399.go (about)

     1  // compile
     2  
     3  package main
     4  
     5  type Foo interface {
     6  	Print()
     7  }
     8  
     9  type Bar struct{}
    10  
    11  func (b Bar) Print() {}
    12  
    13  func main() {
    14  	b := make([]Bar, 20)
    15  	f := make([]Foo, 20)
    16  	for i := range f {
    17  		f[i] = b[i]
    18  	}
    19  	T(f)
    20  	_ = make([]struct{}, 1)
    21  }
    22  
    23  func T(f []Foo) {
    24  	for i := range f {
    25  		f[i].Print()
    26  	}
    27  }