]> Cypherpunks.ru repositories - gostls13.git/blob - test/fixedbugs/issue20250.go
c739b6fb125ad51728036bff5209b04caf11e410
[gostls13.git] / test / fixedbugs / issue20250.go
1 // errorcheck -0 -live -l
2
3 //go:build !goexperiment.cgocheck2
4 // +build !goexperiment.cgocheck2
5
6 // Copyright 2017 The Go Authors. All rights reserved.
7 // Use of this source code is governed by a BSD-style
8 // license that can be found in the LICENSE file.
9
10 // Issue 20250: liveness differed with concurrent compilation
11 // due to propagation of addrtaken to outer variables for
12 // closure variables.
13
14 package p
15
16 type T struct {
17         s [2]string
18 }
19
20 func f(a T) { // ERROR "live at entry to f: a$"
21         var e interface{} // ERROR "stack object e interface \{\}$"
22         func() {          // ERROR "live at entry to f.func1: &e a$"
23                 e = a.s // ERROR "live at call to convT: &e$" "stack object a T$"
24         }()
25         // Before the fix, both a and e were live at the previous line.
26         _ = e
27 }