Skip to content
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: type identity for incomplete structs is not verified. #7409

DanielMorsing opened this issue Feb 25, 2014 · 2 comments


Copy link

commented Feb 25, 2014

cgo turns incomplete types into [0]byte behind the scenes. This means that a pointer to
an incomplete type can be assigned to a pointer to any other incomplete type.


package main

typedef struct foo foo_t;
typedef struct bar bar_t;
foo_t* foofunc() {
    return 0;
bar_t* barfunc() {
    return 0;
import "C"

func main() {
    var a *C.foo_t
    a = C.barfunc()
    _ = a

This comment has been minimized.

Copy link
Contributor Author

commented Mar 27, 2014

Comment 1:

This issue was closed by revision 0f82cfd.

Status changed to Fixed.


This comment has been minimized.

Copy link

commented May 28, 2014

Comment 2:

CL mentions this issue.

@golang golang locked and limited conversation to collaborators Jun 25, 2016

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
2 participants
You can’t perform that action at this time.