Source file test/abi/f_ret_z_not.go
1 // run 2 3 //go:build !wasm 4 5 // Copyright 2021 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 // wasm is excluded because the compiler chatter about register abi pragma ends up 10 // on stdout, and causes the expected output to not match. 11 12 package main 13 14 import "fmt" 15 16 type Z struct { 17 } 18 19 type NZ struct { 20 x, y int 21 } 22 23 //go:noinline 24 func f(x, y int) (Z, NZ, Z) { 25 var z Z 26 return z, NZ{x, y}, z 27 } 28 29 //go:noinline 30 func g() (Z, NZ, Z) { 31 a, b, c := f(3, 4) 32 return c, b, a 33 } 34 35 func main() { 36 _, b, _ := g() 37 fmt.Println(b.x + b.y) 38 } 39