diff options
author | Matthew Dempsky <mdempsky@google.com> | 2021-10-04 16:20:57 -0700 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2021-10-07 18:02:14 +0000 |
commit | 019ad98b5337992625327ea07185ad06a9c19169 (patch) | |
tree | e33c8aa56383fead237747bf5f86ec805856d3a8 /misc | |
parent | be571a36c7aa7198aef4712f8c6cde633e2f380b (diff) | |
download | go-019ad98b5337992625327ea07185ad06a9c19169.tar.gz go-019ad98b5337992625327ea07185ad06a9c19169.zip |
cmd/cgo: update to handle ast.IndexListExpr
Allows cgo to work with generics.
Updates #47781.
Change-Id: Id1a5d1a0a8193c5b157e3e671b1490d687d10384
Reviewed-on: https://go-review.googlesource.com/c/go/+/353882
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'misc')
-rw-r--r-- | misc/cgo/test/typeparam.go | 17 | ||||
-rw-r--r-- | misc/go.mod | 2 |
2 files changed, 18 insertions, 1 deletions
diff --git a/misc/cgo/test/typeparam.go b/misc/cgo/test/typeparam.go new file mode 100644 index 0000000000..5f766c2bcb --- /dev/null +++ b/misc/cgo/test/typeparam.go @@ -0,0 +1,17 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cgotest + +// #include <stddef.h> +import "C" + +func generic[T, U any](t T, u U) {} + +func useGeneric() { + const zero C.size_t = 0 + + generic(zero, zero) + generic[C.size_t, C.size_t](0, 0) +} diff --git a/misc/go.mod b/misc/go.mod index fc9f1133a4..712a051f45 100644 --- a/misc/go.mod +++ b/misc/go.mod @@ -8,4 +8,4 @@ // directory.) module misc -go 1.12 +go 1.18 |