-
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: cgo struct parsing regression #29781
Comments
Thanks for the report. This looks like #29748 and it's already fixed, so I'm closing this issue. |
Just noticed that the tip commit you tested comes after the fix... so I guess it's not fixed? Can you double-check and confirm that the tip version you tested includes the fix for #29748? |
I just rebuilt to be sure, from the latest tip.
Maybe another path to the same issue. |
It also works to change BAR to |
Change https://golang.org/cl/158457 mentions this issue: |
What version of Go are you using (
go version
)?go1.12beta2, Darwin and Linux, amd64.
Does this issue reproduce with the latest release?
I first encountered the issue trying go1.12beta2, and then tip (0456036). This is a regression since go1.11.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Given test.go, a contrived example to reproduce a problem seen in a more complicated setup,
What did you expect to see?
The code should compile.
What did you see instead?
A syntax error, and a bizarre one at that. Line 17 is
C.blah(c, C.BAR+2)
, and it is not 46 characters long.This example compiles and runs fine with Go 1.11. However, with 1.12beta2 something is getting tripped up by the presence of the
void *p;
in the struct definition combined with theC.BAR+2
expression in the second parameter.If
void *p;
is removed and replaced with something likeint x, y;
, there's no problem.Also, all these forms of the call work:
C.blah(nil, C.BAR+2)
C.blah(c, 2)
C.blah(c, C.BAR)
C.blah(c, (C.BAR+2))
C.blah(c, 2+C.BAR)
The text was updated successfully, but these errors were encountered: