github.com/hlts2/go@v0.0.0-20170904000733-812b34efaed8/test/fixedbugs/issue20250.go (about) 1 // errorcheck -0 -live -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: &e a" 20 e = a.s // ERROR "live at call to convT2Estring: &e a" "live at call to writebarrierptr: a" 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 }