| 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 ( |
| 15 |
"fmt" |
| 16 |
) |
| 17 |
|
| 18 |
var sink *string |
| 19 |
|
| 20 |
type toobig struct { |
| 21 |
a, b, c string |
| 22 |
} |
| 23 |
|
| 24 |
//go:registerparams |
| 25 |
//go:noinline |
| 26 |
func H(x toobig) string { |
| 27 |
return x.a + " " + x.b + " " + x.c |
| 28 |
} |
| 29 |
|
| 30 |
func main() { |
| 31 |
s := H(toobig{"Hello", "there,", "World"}) |
| 32 |
gotVsWant(s, "Hello there, World") |
| 33 |
} |
| 34 |
|
| 35 |
func gotVsWant(got, want string) { |
| 36 |
if got != want { |
| 37 |
fmt.Printf("FAIL, got %s, wanted %s\n", got, want) |
| 38 |
} |
| 39 |
} |