diff options
Diffstat (limited to 'test/escape4.go')
| -rw-r--r-- | test/escape4.go | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/test/escape4.go b/test/escape4.go index 887570896..83bc8eb12 100644 --- a/test/escape4.go +++ b/test/escape4.go @@ -1,4 +1,4 @@ -// errchk -0 $G -m $D/$F.go +// errorcheck -0 -m // Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style @@ -37,3 +37,21 @@ func f2() {} // ERROR "can inline f2" // No inline for panic, recover. func f3() { panic(1) } func f4() { recover() } + +func f5() *byte { + type T struct { + x [1]byte + } + t := new(T) // ERROR "new.T. escapes to heap" + return &t.x[0] // ERROR "&t.x.0. escapes to heap" +} + +func f6() *byte { + type T struct { + x struct { + y byte + } + } + t := new(T) // ERROR "new.T. escapes to heap" + return &t.x.y // ERROR "&t.x.y escapes to heap" +} |
