mirror of
https://github.com/golang/go
synced 2024-11-18 09:44:50 -07:00
73f987c88b
Fixes #53439 Change-Id: I425af0f78153511034e4a4648f32ef8c9378a325 Reviewed-on: https://go-review.googlesource.com/c/go/+/449756 Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@google.com>
21 lines
357 B
Go
21 lines
357 B
Go
// compile
|
|
//go:build goexperiment.unified
|
|
|
|
// 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 p
|
|
|
|
import "unsafe"
|
|
|
|
func F[T int](v T) uintptr {
|
|
return unsafe.Offsetof(struct{ f T }{
|
|
func(T) T { return v }(v),
|
|
}.f)
|
|
}
|
|
|
|
func f() {
|
|
F(1)
|
|
}
|