diff options
author | Ondřej Surý <ondrej@sury.org> | 2012-03-26 16:50:58 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2012-03-26 16:50:58 +0200 |
commit | 519725bb3c075ee2462c929f5997cb068e18466a (patch) | |
tree | 5b162e8488ad147a645048c073577821b4a2bee9 /test/escape4.go | |
parent | 842623c5dd2819d980ca9c58048d6bc6ed82475f (diff) | |
download | golang-upstream-weekly/2012.03.22.tar.gz |
Imported Upstream version 2012.03.22upstream-weekly/2012.03.22
Diffstat (limited to 'test/escape4.go')
-rw-r--r-- | test/escape4.go | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/test/escape4.go b/test/escape4.go index ab3aee224..887570896 100644 --- a/test/escape4.go +++ b/test/escape4.go @@ -11,8 +11,8 @@ package foo var p *int -func alloc(x int) *int { // ERROR "can inline alloc" "moved to heap: x" - return &x // ERROR "&x escapes to heap" +func alloc(x int) *int { // ERROR "can inline alloc" "moved to heap: x" + return &x // ERROR "&x escapes to heap" } var f func() @@ -22,12 +22,18 @@ func f1() { // Escape analysis used to miss inlined code in closures. - func() { // ERROR "func literal does not escape" - p = alloc(3) // ERROR "inlining call to alloc" "&x escapes to heap" "moved to heap: x" + func() { // ERROR "func literal does not escape" + p = alloc(3) // ERROR "inlining call to alloc" "&x escapes to heap" "moved to heap: x" }() - - f = func() { // ERROR "func literal escapes to heap" - p = alloc(3) // ERROR "inlining call to alloc" "&x escapes to heap" "moved to heap: x" + + f = func() { // ERROR "func literal escapes to heap" + p = alloc(3) // ERROR "inlining call to alloc" "&x escapes to heap" "moved to heap: x" } f() } + +func f2() {} // ERROR "can inline f2" + +// No inline for panic, recover. +func f3() { panic(1) } +func f4() { recover() } |