Fixes issue golang/go#17563
Change-Id: Ibb41ea9419907193526cc601f6afd07d8689b1fe
Reviewed-on: https://go-review.googlesource.com/31810
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
return
}
+ // A call to C.CBytes passes a pointer but is always safe.
+ if sel.Sel.Name == "CBytes" {
+ return
+ }
+
for _, arg := range x.Args {
if !typeOKForCgoCall(cgoBaseType(f, arg)) {
f.Badf(arg.Pos(), "possibly passing Go type with embedded pointer to C")
var st2 struct{ i int }
C.f(*(*unsafe.Pointer)(unsafe.Pointer(&st2)))
C.f(unsafe.Pointer(&st2))
+
+ C.CBytes([]byte("hello"))
}