Source file test/fixedbugs/issue27732a.go

     1  // errorcheck -0 -m -l -smallframes
     2  
     3  // Copyright 2019 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  // This checks that the -smallframes flag forces a large variable to heap.
     8  
     9  package main
    10  
    11  const (
    12  	bufferLen = 200000
    13  )
    14  
    15  type kbyte []byte
    16  type circularBuffer [bufferLen]kbyte
    17  
    18  var sink byte
    19  
    20  func main() {
    21  	var c circularBuffer // ERROR "moved to heap: c$"
    22  	sink = c[0][0]
    23  }
    24  

View as plain text