summaryrefslogtreecommitdiffstats
path: root/test/typeparam/issue54537.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--test/typeparam/issue54537.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/typeparam/issue54537.go b/test/typeparam/issue54537.go
new file mode 100644
index 0000000..614ed46
--- /dev/null
+++ b/test/typeparam/issue54537.go
@@ -0,0 +1,22 @@
+// run
+
+// Copyright 2022 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 main
+
+func main() {
+ _ = F[bool]
+
+ var x string
+ _ = G(x == "foo")
+}
+
+func F[T ~bool](x string) {
+ var _ T = x == "foo"
+}
+
+func G[T any](t T) *T {
+ return &t
+}