-
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: types regression for anonymous structs #38408
Comments
Looks like another case caused by https://golang.org/cl/181857, also see #37479 and #37621 /cc @ianlancetaylor |
@gopherbot Please add issue for backport to Go 1.14. This is an incompatible change to how cgo handles anonymous structs. There is no workaround for people using C headers that use the construct that changed incompatibly. We should fix this in the 1.14 branch. |
Backport issue(s) opened: #38426 (for 1.14). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases. |
Change https://golang.org/cl/228102 mentions this issue: |
Change https://golang.org/cl/228107 mentions this issue: |
…struct For #31891 For #38408 Fixes #38426 Change-Id: Ie7498c2cab728ae798e66e7168425e16b063520e Reviewed-on: https://go-review.googlesource.com/c/go/+/228102 Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> (cherry picked from commit 33ff63d) Reviewed-on: https://go-review.googlesource.com/c/go/+/228107 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
The issue is reproduced on any go1.14+ and not reproduced on go1.13.10 and below
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Use a typedef on anonymous struct in
cgo
:Then just build it:
go build -a .
What did you expect to see?
Nothing and successfully compiled binary
What did you see instead?
Additional info
According to
_cgo_gotypes.go
it looks like compiler can't understand that*A
andPA
is the same type and generates 2 identically structures for them.The issue is not reproduced neither for named strucutres, e.g.
nor for 2 separate typedefs:
The text was updated successfully, but these errors were encountered: