github.com/mattn/go@v0.0.0-20171011075504-07f7db3ea99f/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  }