aboutsummaryrefslogtreecommitdiff
path: root/test/escape2.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2019-09-24 17:35:15 -0700
committerMatthew Dempsky <mdempsky@google.com>2019-09-25 17:06:15 +0000
commitf346a4c44c7200454d01c05879fbcd76a1ca9237 (patch)
treeaedc700b06e7396c6f2738b6a956914b17217d33 /test/escape2.go
parent8189a06190046cd69819ad1c6399943be0ee5c2d (diff)
downloadgo-f346a4c44c7200454d01c05879fbcd76a1ca9237.tar.gz
go-f346a4c44c7200454d01c05879fbcd76a1ca9237.zip
test: add regress test for #27557
This commit just adds a regress test for a few of the important corner cases that I identified in #27557, which turn out to not be tested anywhere. While here, annotate a few of the existing test cases where we could improve escape analysis. Updates #27557. Change-Id: Ie57792a538f7899bb17915485fabc86100f469a3 Reviewed-on: https://go-review.googlesource.com/c/go/+/197137 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'test/escape2.go')
-rw-r--r--test/escape2.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/test/escape2.go b/test/escape2.go
index b7cd914c22..4e30331380 100644
--- a/test/escape2.go
+++ b/test/escape2.go
@@ -1386,6 +1386,7 @@ func (t *Tm) M() { // ERROR "t does not escape$"
func foo141() {
var f func()
+ // BAD: new(Tm) should not escape
t := new(Tm) // ERROR "new\(Tm\) escapes to heap$"
f = t.M // ERROR "t.M does not escape$"
_ = f