Skip to content

Commit ca6999e

Browse files
committed
[dev.regabi] test: add a test for inlining closures
Add a test case for issue 43818. We don't want to mark as inlinable a function with a closure that has an operation (such as OSELRECV2) that we don't currently support for exporting. This test case fails to compile without the fix for #43818. Updates #43818 Change-Id: Ief322a14aefaefc6913c40a6b8505214bd622fda Reviewed-on: https://go-review.googlesource.com/c/go/+/288392 Run-TryBot: Dan Scales <[email protected]> Reviewed-by: Cuong Manh Le <[email protected]> TryBot-Result: Go Bot <[email protected]> Trust: Dan Scales <[email protected]>
1 parent aca22bd commit ca6999e

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/closure7.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// run
2+
3+
// Copyright 2020 The Go Authors. All rights reserved.
4+
// Use of this source code is governed by a BSD-style
5+
// license that can be found in the LICENSE file.
6+
7+
package main
8+
9+
func g(f func()) {
10+
}
11+
12+
// Must have exportable name
13+
func F() {
14+
g(func() {
15+
ch := make(chan int)
16+
for {
17+
select {
18+
case <-ch:
19+
return
20+
default:
21+
}
22+
}
23+
})
24+
}
25+
26+
func main() {
27+
F()
28+
}

0 commit comments

Comments
 (0)