0
1
mirror of https://github.com/golang/go synced 2025-06-14 17:31:48 +00:00
Files
go/test/fixedbugs/issue73716.go
Yongyue Sun fc641e7fae cmd/compile: create LSym for closures with type conversion
Follow-up to #54959 with another failing case.

The linker needs FuncInfo metadata for all inlined functions. CL 436240 explicitly creates LSym for direct closure calls to ensure we keep the FuncInfo metadata.

However, CL 436240 won't work if the direct closure call is wrapped by a no-effect type conversion, even if that closure could be inlined.

This commit should fix such case.

Fixes #73716

Change-Id: Icda6024da54c8d933f87300e691334c080344695
GitHub-Last-Rev: e9aed02eb6
GitHub-Pull-Request: golang/go#73718
Reviewed-on: https://go-review.googlesource.com/c/go/+/672855
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-05-15 13:16:39 -07:00

38 lines
529 B
Go

// build
// Copyright 2025 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.
// Issue 73716: cmd/compile: unnamed functions missing FuncInfo
package main
import "fmt"
type EP func()
type F func(EP) EP
func main() {
eps := []EP{ep1, ep2}
var h EP
for _, ep := range eps {
h = F(func(e EP) EP {
return func() {
ep()
e()
}
})(h)
}
h()
}
func ep1() {
fmt.Printf("ep1\n")
}
func ep2() {
fmt.Printf("ep2\n")
}