Source file test/fixedbugs/issue24651a.go

     1  //errorcheck -0 -race -m -m
     2  
     3  //go:build (linux && amd64) || (linux && ppc64le) || (darwin && amd64) || (freebsd && amd64) || (netbsd && amd64) || (windows && amd64)
     4  
     5  // Copyright 2018 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  package main
    10  
    11  //go:norace
    12  func Foo(x int) int { // ERROR "cannot inline Foo: marked go:norace with -race compilation$"
    13  	return x * (x + 1) * (x + 2)
    14  }
    15  
    16  func Bar(x int) int { // ERROR "can inline Bar with cost .* as: func\(int\) int { return x \* \(x \+ 1\) \* \(x \+ 2\) }$"
    17  	return x * (x + 1) * (x + 2)
    18  }
    19  
    20  var x = 5
    21  
    22  //go:noinline Provide a clean, constant reason for not inlining main
    23  func main() { // ERROR "cannot inline main: marked go:noinline$"
    24  	println("Foo(", x, ")=", Foo(x))
    25  	println("Bar(", x, ")=", Bar(x)) // ERROR "inlining call to Bar"
    26  }
    27  

View as plain text