Source file test/fixedbugs/issue39292.go

     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  
     7  package p
     8  
     9  type t [20000]*int
    10  
    11  func (t) f() {
    12  }
    13  
    14  func x() {
    15  	x := t{}.f // ERROR "t{}.f escapes to heap"
    16  	x()
    17  }
    18  
    19  func 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  
    25  func 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  

View as plain text