1
0
mirror of https://github.com/golang/go synced 2024-11-08 19:16:25 -07:00
go/test/inline_variadic.go
Matthew Dempsky 09d4455f45 cmd/compile: enable inlining variadic functions
As a side effect of working on mid-stack inlining, we've fixed support
for inlining variadic functions. Might as well enable it.

Change-Id: I7f555f8b941969791db7eb598c0b49f6dc0820aa
Reviewed-on: https://go-review.googlesource.com/100456
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-03-13 20:34:03 +00:00

20 lines
516 B
Go

// errorcheck -0 -m
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test inlining of variadic functions.
// See issue #18116.
package foo
func head(xs ...string) string { // ERROR "can inline head" "leaking param: xs to result"
return xs[0]
}
func f() string { // ERROR "can inline f"
x := head("hello", "world") // ERROR "inlining call to head" "\[\]string literal does not escape"
return x
}