blob: 96b008711c901cd7ff18212fbbba1fceb1f3418b [file] [edit]
// run -goexperiment genericmethods
// Copyright 2026 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.
// Verify that generic methods work with pointer receivers.
package main
import "fmt"
type T struct {}
func (t *T) m[P any]() {
var x P
if got := fmt.Sprintf("%T", x); got != "int" {
panic(fmt.Sprintf("got %s, want int", got))
}
}
func main() {
(&T{}).m[int]()
}