diff options
Diffstat (limited to 'test/nilptr.go')
-rw-r--r-- | test/nilptr.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/nilptr.go b/test/nilptr.go index b784914e5..793e99673 100644 --- a/test/nilptr.go +++ b/test/nilptr.go @@ -38,6 +38,8 @@ func main() { shouldPanic(p8) shouldPanic(p9) shouldPanic(p10) + shouldPanic(p11) + shouldPanic(p12) } func shouldPanic(f func()) { @@ -130,3 +132,23 @@ func p10() { var t *T println(t.i) // should crash } + +type T1 struct { + T +} + +type T2 struct { + *T1 +} + +func p11() { + t := &T2{} + p := &t.i + println(*p) +} + +// ADDR(DOT(IND(p))) needs a check also +func p12() { + var p *T = nil + println(*(&((*p).i))) +} |