From 73f987c88b348772ca2efa8d5b3d0ac61cbdb563 Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Fri, 11 Nov 2022 13:02:44 +0700 Subject: [PATCH] test: add regression test for issue 53439 Fixes #53439 Change-Id: I425af0f78153511034e4a4648f32ef8c9378a325 Reviewed-on: https://go-review.googlesource.com/c/go/+/449756 Run-TryBot: Cuong Manh Le Reviewed-by: Michael Knyszek TryBot-Result: Gopher Robot Reviewed-by: Keith Randall Auto-Submit: Cuong Manh Le Reviewed-by: Keith Randall --- test/fixedbugs/issue53439.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test/fixedbugs/issue53439.go diff --git a/test/fixedbugs/issue53439.go b/test/fixedbugs/issue53439.go new file mode 100644 index 0000000000..dc444b889a --- /dev/null +++ b/test/fixedbugs/issue53439.go @@ -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) +} -- 2.50.0