-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/cgo: panic in enum #3368
Labels
Comments
This appears to be an error due to invalid input: The enum is called _cairo_hint_style, so it should be C.enum__cairo_hint_style: package test /* typedef enum _cairo_hint_style { CAIRO_HINT_STYLE_DEFAULT, CAIRO_HINT_STYLE_NONE, } cairo_hint_style_t; int test(cairo_hint_style_t st) { return st; } */ import "C" type CairoHintStyle int func testfunc(st CairoHintStyle) { C.test(C.enum__cairo_hint_style(st)) } No clear that we need to fix this for Go 1. The crash is on line src/cmd/cgo/gcc.go:658 is due to r.Name.Type being nil. Labels changed: added priority-triage, cgo, removed priority-go1, go1-must. |
Update: the panic doesn't occur now, but apparently cgo still can't diagnose this problem: cgo.go:19[/tmp/.../_obj/cgo.cgo1.go:13]: cannot convert st (type CairoHintStyle) to type [0]byte cgo.go:19[/tmp/.../_obj/cgo.cgo1.go:13]: cannot use ([0]byte)(st) (type [0]byte) as type _Ctype_cairo_hint_style_t in function argument a corrected version could be: package main /* typedef enum _cairo_hint_style { CAIRO_HINT_STYLE_DEFAULT, CAIRO_HINT_STYLE_NONE, } cairo_hint_style_t; int test(cairo_hint_style_t st) { return st; } */ import "C" type CairoHintStyle int func f(st CairoHintStyle) { C.test(C.cairo_hint_style_t(st)) } |
When you compile the example from the first post (go version devel +5dbe071 Sat Jun 6 02:17:49 2015 +0000 linux/amd64
other code that reproduces the error:
|
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by RMiB.email:
Attachments:
The text was updated successfully, but these errors were encountered: