Source file test/fixedbugs/issue8761.go

     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 f1() {
    14  	type C chan int
    15  	_ = [1][]C{[]C{make(chan int)}}
    16  }
    17  
    18  func f2() {
    19  	type C interface{}
    20  	_ = [1][]C{[]C{recover()}}
    21  }
    22  
    23  func f3() {
    24  	type C *int
    25  	_ = [1][]C{[]C{new(int)}}
    26  }
    27  

View as plain text