diff options
Diffstat (limited to 'test/typeparam/issue49538.go')
-rw-r--r-- | test/typeparam/issue49538.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/typeparam/issue49538.go b/test/typeparam/issue49538.go new file mode 100644 index 0000000..cb22a06 --- /dev/null +++ b/test/typeparam/issue49538.go @@ -0,0 +1,23 @@ +// compile + +// 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 p + +type I interface { + M(interface{}) +} + +type a[T any] struct{} + +func (a[T]) M(interface{}) {} + +func f[T I](t *T) { + (*t).M(t) +} + +func g() { + f(&a[int]{}) +} |