Skip to content

Commit f85d0e3

Browse files
fraenkelmdempsky
authored andcommitted
test: add escape regress for empty variadic function
Fixes #30898 Change-Id: I903dd8ed2b10c49b2291ad0858774f3ca2f5b223 Reviewed-on: https://go-review.googlesource.com/c/go/+/172422 Reviewed-by: Matthew Dempsky <[email protected]> Run-TryBot: Matthew Dempsky <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent ff3ae45 commit f85d0e3

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/fixedbugs/issue30898.go

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// errorcheck -0 -m
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+
// Test escape analysis for functions with variadic arguments
8+
9+
package foo
10+
11+
func debugf(format string, args ...interface{}) { // ERROR "can inline debugf" "format does not escape" "args does not escape"
12+
// Dummy implementation for non-debug build.
13+
// A non-empty implementation would be enabled with a build tag.
14+
}
15+
16+
func bar() { // ERROR "can inline bar"
17+
value := 10
18+
debugf("value is %d", value) // ERROR "inlining call to debugf" "value does not escape" "\[\]interface {} literal does not escape"
19+
}

0 commit comments

Comments
 (0)