diff options
author | Cherry Zhang <cherryyz@google.com> | 2016-08-17 10:32:39 -0400 |
---|---|---|
committer | Cherry Zhang <cherryyz@google.com> | 2016-08-17 14:50:34 +0000 |
commit | 04e76f295f434bf1bd5ef3b01eed42b638a8b321 (patch) | |
tree | c90d57d5792427de7b81c9593c6e111f39f34697 /test/nilptr3.go | |
parent | 507144c011c64fd6f18cee6592e79461817e3791 (diff) | |
download | go-04e76f295f434bf1bd5ef3b01eed42b638a8b321.tar.gz go-04e76f295f434bf1bd5ef3b01eed42b638a8b321.zip |
test: add test for CL 26831
Test nil check removal for access of PAUTOHEAP.
Change-Id: Id739a9cda7cd3ff173bdcccfedcad93ee90711ef
Reviewed-on: https://go-review.googlesource.com/27232
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'test/nilptr3.go')
-rw-r--r-- | test/nilptr3.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/nilptr3.go b/test/nilptr3.go index a81efb7d8e..73e074391b 100644 --- a/test/nilptr3.go +++ b/test/nilptr3.go @@ -214,3 +214,11 @@ func p1() byte { p := new([100]byte) return p[5] // ERROR "removed nil check" } + +// make sure not to do nil check for access of PAUTOHEAP +//go:noinline +func (p *Struct) m() {} +func c1() { + var x Struct + func() { x.m() }() // ERROR "removed nil check" +} |