]> Cypherpunks repositories - gostls13.git/commitdiff
test: add regression test for issue 53439
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Fri, 11 Nov 2022 06:02:44 +0000 (13:02 +0700)
committerGopher Robot <gobot@golang.org>
Fri, 11 Nov 2022 14:48:29 +0000 (14:48 +0000)
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>
test/fixedbugs/issue53439.go [new file with mode: 0644]

diff --git a/test/fixedbugs/issue53439.go b/test/fixedbugs/issue53439.go
new file mode 100644 (file)
index 0000000..dc444b8
--- /dev/null
@@ -0,0 +1,20 @@
+// 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)
+}