Source file test/fixedbugs/issue4099.go

     1  // errorcheck -0 -m
     2  
     3  //go:build !goexperiment.newinliner
     4  
     5  // Copyright 2013 The Go Authors. All rights reserved.
     6  // Use of this source code is governed by a BSD-style
     7  // license that can be found in the LICENSE file.
     8  
     9  // Check go:noescape annotations.
    10  
    11  package p
    12  
    13  // The noescape comment only applies to the next func,
    14  // which must not have a body.
    15  
    16  //go:noescape
    17  
    18  func F1([]byte)
    19  
    20  func F2([]byte)
    21  
    22  func G() {
    23  	var buf1 [10]byte
    24  	F1(buf1[:])
    25  
    26  	var buf2 [10]byte // ERROR "moved to heap: buf2"
    27  	F2(buf2[:])
    28  }
    29  

View as plain text