github.com/sbinet/go@v0.0.0-20160827155028-54d7de7dd62b/test/live2.go (about) 1 // +build !amd64 2 // errorcheck -0 -live -wb=0 3 4 // Copyright 2014 The Go Authors. All rights reserved. 5 // Use of this source code is governed by a BSD-style 6 // license that can be found in the LICENSE file. 7 8 // liveness tests with inlining ENABLED 9 // see also live.go. 10 11 package main 12 13 // issue 8142: lost 'addrtaken' bit on inlined variables. 14 // no inlining in this test, so just checking that non-inlined works. 15 16 func printnl() 17 18 type T40 struct { 19 m map[int]int 20 } 21 22 func newT40() *T40 { 23 ret := T40{} 24 ret.m = make(map[int]int) // ERROR "live at call to makemap: &ret" 25 return &ret 26 } 27 28 func bad40() { 29 t := newT40() // ERROR "live at call to makemap: autotmp_.* ret" 30 printnl() // ERROR "live at call to printnl: autotmp_.* ret" 31 _ = t 32 } 33 34 func good40() { 35 ret := T40{} 36 ret.m = make(map[int]int) // ERROR "live at call to makemap: autotmp_.* ret" 37 t := &ret 38 printnl() // ERROR "live at call to printnl: autotmp_.* ret" 39 _ = t 40 }