diff options
| author | Michael Stapelberg <michael@stapelberg.de> | 2013-03-23 11:29:06 +0100 |
|---|---|---|
| committer | Michael Stapelberg <michael@stapelberg.de> | 2013-03-23 11:29:06 +0100 |
| commit | cc71238f4c5d23ee2ebffd0d6c307e308ea163c1 (patch) | |
| tree | dd0b57254871fac715258385f5485ba136d6b62a /test/escape2.go | |
| parent | b32e37d71adab0e2a2b7c4433e7bad169a9a4f98 (diff) | |
| parent | b39e15dde5ec7b96c15da9faf4ab5892501c1aae (diff) | |
| download | golang-cc71238f4c5d23ee2ebffd0d6c307e308ea163c1.tar.gz | |
Merge tag 'upstream/1.1_hg20130323' into debian-sid
Upstream version 1.1~hg20130323
Diffstat (limited to 'test/escape2.go')
| -rw-r--r-- | test/escape2.go | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/test/escape2.go b/test/escape2.go index 948161933..511b74a1c 100644 --- a/test/escape2.go +++ b/test/escape2.go @@ -80,7 +80,9 @@ func foo12(yyy **int) { // ERROR "leaking param: yyy" xxx = yyy } -func foo13(yyy **int) { // ERROR "yyy does not escape" +// Must treat yyy as leaking because *yyy leaks, and the escape analysis +// summaries in exported metadata do not distinguish these two cases. +func foo13(yyy **int) { // ERROR "leaking param: yyy" *xxx = *yyy } @@ -299,7 +301,8 @@ func (f *Foo) foo45() { // ERROR "f does not escape" F.x = f.x } -func (f *Foo) foo46() { // ERROR "f does not escape" +// See foo13 above for explanation of why f leaks. +func (f *Foo) foo46() { // ERROR "leaking param: f" F.xx = f.xx } @@ -1300,3 +1303,25 @@ func G() { var buf4 [10]byte // ERROR "moved to heap: buf4" F4(buf4[:]) // ERROR "buf4 escapes to heap" } + +type Tm struct { + x int +} + +func (t *Tm) M() { // ERROR "t does not escape" +} + +func foo141() { + var f func() + + t := new(Tm) // ERROR "escapes to heap" + f = t.M // ERROR "t.M does not escape" + _ = f +} + +var gf func() + +func foo142() { + t := new(Tm) // ERROR "escapes to heap" + gf = t.M // ERROR "t.M escapes to heap" +} |
