github.com/razvanm/vanadium-go-1.3@v0.0.0-20160721203343-4a65068e5915/test/live2.go (about) 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 }