diff options
Diffstat (limited to 'misc/cgo/errors/ptr.go')
-rw-r--r-- | misc/cgo/errors/ptr.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/misc/cgo/errors/ptr.go b/misc/cgo/errors/ptr.go index 834cde9199..bbcaaabecb 100644 --- a/misc/cgo/errors/ptr.go +++ b/misc/cgo/errors/ptr.go @@ -123,6 +123,16 @@ var ptrTests = []ptrTest{ fail: false, }, { + // Passing the address of a slice of an array that is + // an element in a struct, with a type conversion. + name: "slice-ok-4", + c: `typedef void* PV; void f(PV p) {}`, + imports: []string{"unsafe"}, + support: `type S struct { p *int; a [4]byte }`, + body: `i := 0; p := &S{p:&i}; C.f(C.PV(unsafe.Pointer(&p.a[0])))`, + fail: false, + }, + { // Passing the address of a static variable with no // pointers doesn't matter. name: "varok", |