3 // Copyright 2015 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.
7 // Test, using compiler diagnostic flags, that inlining is working.
8 // Compiles but does not run.
14 func add2(p *byte, n uintptr) *byte { // ERROR "can inline add2" "leaking param: p to result"
15 return (*byte)(add1(unsafe.Pointer(p), n)) // ERROR "inlining call to add1"
18 func add1(p unsafe.Pointer, x uintptr) unsafe.Pointer { // ERROR "can inline add1" "leaking param: p to result"
19 return unsafe.Pointer(uintptr(p) + x)
22 func f(x *byte) *byte { // ERROR "can inline f" "leaking param: x to result"
23 return add2(x, 1) // ERROR "inlining call to add2" "inlining call to add1"
31 func h(x int) int { // ERROR "can inline h"
35 func i(x int) int { // ERROR "can inline i"