test/typeparam/pragma.go
raw| 1 | // errorcheck -0 -m |
| 2 | |
| 3 | // Copyright 2021 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. |
| 6 | |
| 7 | // Make sure the go:noinline pragma makes it from a |
| 8 | // generic function to any of its stenciled instances. |
| 9 | |
| 10 | package main |
| 11 | |
| 12 | //go:noinline |
| 13 | func f[T any](x T) T { |
| 14 | return x |
| 15 | } |
| 16 | |
| 17 | func main() { // ERROR "can inline main" |
| 18 | println(f(5)) |
| 19 | } |