]> Cypherpunks.ru repositories - gostls13.git/blob - test/live2.go
cmd/gc: fix call order in array literal of slice literal of make chan
[gostls13.git] / test / live2.go
1 // errorcheck -0 -live -wb=0
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 // liveness tests with inlining ENABLED
8 // see also live.go.
9
10 package main
11
12 // issue 8142: lost 'addrtaken' bit on inlined variables.
13 // no inlining in this test, so just checking that non-inlined works.
14
15 type T40 struct {
16         m map[int]int
17 }
18
19 func newT40() *T40 {
20         ret := T40{}
21         ret.m = make(map[int]int) // ERROR "live at call to makemap: &ret"
22         return &ret
23 }
24
25 func bad40() {
26         t := newT40() // ERROR "live at call to makemap: ret"
27         println()     // ERROR "live at call to printnl: ret"
28         _ = t
29 }
30
31 func good40() {
32         ret := T40{}
33         ret.m = make(map[int]int) // ERROR "live at call to makemap: ret"
34         t := &ret
35         println() // ERROR "live at call to printnl: ret"
36         _ = t
37 }