~ubuntu-branches/ubuntu/saucy/golang/saucy

« back to all changes in this revision

Viewing changes to test/nilptr.go

  • Committer: Package Import Robot
  • Author(s): Adam Conrad
  • Date: 2013-07-08 05:52:37 UTC
  • mfrom: (29.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20130708055237-at01839e0hp8z3ni
Tags: 2:1.1-1ubuntu1
016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
        shouldPanic(p8)
39
39
        shouldPanic(p9)
40
40
        shouldPanic(p10)
 
41
        shouldPanic(p11)
 
42
        shouldPanic(p12)
41
43
}
42
44
 
43
45
func shouldPanic(f func()) {
130
132
        var t *T
131
133
        println(t.i) // should crash
132
134
}
 
135
 
 
136
type T1 struct {
 
137
        T
 
138
}
 
139
 
 
140
type T2 struct {
 
141
        *T1
 
142
}
 
143
 
 
144
func p11() {
 
145
        t := &T2{}
 
146
        p := &t.i
 
147
        println(*p)
 
148
}
 
149
 
 
150
// ADDR(DOT(IND(p))) needs a check also
 
151
func p12() {
 
152
        var p *T = nil
 
153
        println(*(&((*p).i)))
 
154
}