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

     1  // compile
     2  
     3  // Copyright 2014 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  // issue 8761
     8  // used to confuse code generator into using temporary before initialization.
     9  // caused 'variable live at entry' error in liveness analysis.
    10  
    11  package p
    12  
    13  func _() {
    14  	type C chan int
    15  	_ = [1][]C{[]C{make(chan int)}}
    16  }
    17  
    18  func _() {
    19  	type C interface{}
    20  	_ = [1][]C{[]C{recover()}}
    21  }
    22  
    23  func _() {
    24  	type C *int
    25  	_ = [1][]C{[]C{new(int)}}
    26  }