...
Run Format

Source file test/fixedbugs/issue20250.go

Documentation: test/fixedbugs

     1  // errorcheck -0 -live -l -d=compilelater
     2  
     3  // Copyright 2017 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 20250: liveness differed with concurrent compilation
     8  // due to propagation of addrtaken to outer variables for
     9  // closure variables.
    10  
    11  package p
    12  
    13  type T struct {
    14  	s string
    15  }
    16  
    17  func f(a T) { // ERROR "live at entry to f: a"
    18  	var e interface{}
    19  	func() { // ERROR "live at entry to f.func1: a &e"
    20  		e = a.s // ERROR "live at call to convT2Estring: a &e"
    21  	}() // ERROR "live at call to f.func1: e$"
    22  	// Before the fix, both a and e were live at the previous line.
    23  	_ = e
    24  }
    25  

View as plain text