Skip to content

Commit

Permalink
[dev.regabi] test: add a test for inlining closures
Browse files Browse the repository at this point in the history
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 <danscales@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dan Scales <danscales@google.com>
  • Loading branch information
danscales committed Feb 1, 2021
1 parent aca22bd commit ca6999e
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/closure7.go
@@ -0,0 +1,28 @@
// run

// Copyright 2020 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 main

func g(f func()) {
}

// Must have exportable name
func F() {
g(func() {
ch := make(chan int)
for {
select {
case <-ch:
return
default:
}
}
})
}

func main() {
F()
}

0 comments on commit ca6999e

Please sign in to comment.