-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.release-blocker
Milestone
Description
There seems to be a regression regarding calling C functions with typedef pointer arguments in go 1.11/1.10.4
The following code
package main
// typedef struct {
// int a;
// } S, *PTRS;
//
// void cfuncptr(PTRS s) {}
import "C"
func main() {
var s C.S
C.cfuncptr(C.PTRS(&s))
}
previously generated a C compiler warning (#19832). With go 1.11 (and go 1.10.4) this results in a build failure
$ go version
go version go1.11 linux/amd64
$ go run c.go
# command-line-arguments
cgo-gcc-prolog: In function '_cgo_89f4f567c189_Cfunc_cfuncptr':
cgo-gcc-prolog:40:17: warning: passing argument 1 of 'cfuncptr' from incompatible pointer type [-Wincompatible-pointer-types]
./c.go:7:21: note: expected 'PTRS' {aka 'struct <anonymous> *'} but argument is of type 'struct <anonymous> *'
// void cfuncptr(PTRS s) {}
~~~~~^
# command-line-arguments
./c.go:12:31: cannot use _Ctype_PTRS(&s) (type _Ctype_PTRS) as type *_Ctype_struct___1 in argument to _Cfunc_cfuncptr
``
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.release-blocker