mirror of
https://github.com/golang/go
synced 2024-11-06 16:36:20 -07:00
19156a5474
CL 395854 made inline pass to not inlining function with shape params, but pass no shape arguments. But it does not consider the case where function has shape params, but passing zero arguments. In this case, the un-safe interface conversion that may be applied to a shape argument can not happen, so it's safe to inline the function. Fixes #52907 Change-Id: Ifa7b23709bb47b97e27dc1bf32343d92683ef783 Reviewed-on: https://go-review.googlesource.com/c/go/+/406176 Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
20 lines
295 B
Go
20 lines
295 B
Go
// compile
|
|
|
|
// 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 f[T int](t T) {
|
|
for true {
|
|
func() {
|
|
t = func() T { return t }()
|
|
}()
|
|
}
|
|
}
|
|
|
|
func main() {
|
|
f(0)
|
|
}
|