mirror of
https://github.com/golang/go
synced 2024-11-17 08:24:43 -07:00
4b10e4c547
Fixes #46472 Change-Id: I27802978fa0c3bb32a29e452165a6fcac93473bb Reviewed-on: https://go-review.googlesource.com/c/go/+/323731 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
21 lines
351 B
Go
21 lines
351 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 foo[T any](d T) {
|
|
switch v := interface{}(d).(type) {
|
|
case string:
|
|
if v != "x" {
|
|
panic("unexpected v: "+v)
|
|
}
|
|
}
|
|
|
|
}
|
|
func main() {
|
|
foo("x")
|
|
}
|