1// errorcheck -0 -m -l 2 3// Copyright 2020 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 7package p 8 9type t [20000]*int 10 11func (t) f() { 12} 13 14func x() { 15 x := t{}.f // ERROR "t{}.f escapes to heap" 16 x() 17} 18 19func y() { 20 var i int // ERROR "moved to heap: i" 21 y := (&t{&i}).f // ERROR "\(&t{...}\).f escapes to heap" "&t{...} escapes to heap" 22 y() 23} 24 25func z() { 26 var i int // ERROR "moved to heap: i" 27 z := t{&i}.f // ERROR "t{...}.f escapes to heap" 28 z() 29} 30