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

Closed
DanielMorsing opened this issue Feb 25, 2014 · 2 comments
Closed

cmd/cgo: type identity for incomplete structs is not verified. #7409

DanielMorsing opened this issue Feb 25, 2014 · 2 comments

Comments

@DanielMorsing
Copy link
Contributor

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.

Example:

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
}
@DanielMorsing
Copy link
Contributor Author

Comment 1:

This issue was closed by revision 0f82cfd.

Status changed to Fixed.

@gopherbot
Copy link

Comment 2:

CL https://golang.org/cl/98580046 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.
Projects
None yet
Development

No branches or pull requests

2 participants