src/cmd/cgo/internal/test/typeparam.go
raw| 1 | // Copyright 2021 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package cgotest |
| 6 | |
| 7 | // #include <stddef.h> |
| 8 | import "C" |
| 9 | |
| 10 | func generic[T, U any](t T, u U) {} |
| 11 | |
| 12 | func useGeneric() { |
| 13 | const zero C.size_t = 0 |
| 14 | |
| 15 | generic(zero, zero) |
| 16 | generic[C.size_t, C.size_t](0, 0) |
| 17 | } |