diff options
| author | Ian Lance Taylor <iant@golang.org> | 2016-02-23 16:11:46 -0800 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2016-02-27 22:51:51 +0000 |
| commit | 71cc445cf92dd3014e8b382809ed1b9c077e7973 (patch) | |
| tree | 7df3bdc3968fdb7dd61c9c9a18380601859fd1ca /misc/cgo/errors | |
| parent | 922ce58de0181c114c09e6fbd6ab28f1d477898d (diff) | |
| download | go-71cc445cf92dd3014e8b382809ed1b9c077e7973.tar.xz | |
cmd/cgo: recognize known C typedefs as types
Fixes #14483.
Change-Id: I0cddfe27fd8d00ba85659d0b618410e39ebf45cb
Reviewed-on: https://go-review.googlesource.com/19860
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'misc/cgo/errors')
| -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", |
