mirror of
https://github.com/golang/go
synced 2024-09-04 23:44:16 +00:00
![Keith Randall](/assets/img/avatar_default.png)
A generic conversion might be required for when converting T->interface{}. When stenciled with T=interface{}, then that conversion doesn't need to do anything. Fixes #48276 Change-Id: Ife65d01c99fbd0895cb7eec79df9e93e752b1fa5 Reviewed-on: https://go-review.googlesource.com/c/go/+/348736 Trust: Keith Randall <khr@golang.org> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org>
16 lines
280 B
Go
16 lines
280 B
Go
// run -gcflags=-G=3
|
|
|
|
// 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 main
|
|
|
|
func main() {
|
|
f[interface{}](nil)
|
|
}
|
|
|
|
func f[T any](x T) {
|
|
var _ interface{} = x
|
|
}
|