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