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

Segfault on casting C enum type to c_int #1036

adrusi opened this Issue Jun 2, 2018 · 3 comments


None yet
3 participants

adrusi commented Jun 2, 2018

The following code causes the compiler to segfault:

const c = @cImport({

pub fn main() void {
    var sock_dgram = @bitCast(c_int, c.SOCK_DGRAM);


$ zig build-exe main.zig
TODO buf_write_value_bytes enum type
zsh: abort (core dumped)  zig build-exe main.zig

@andrewrk andrewrk added the bug label Jun 2, 2018

@andrewrk andrewrk added this to the 0.3.0 milestone Jun 2, 2018


This comment has been minimized.


andrewrk commented Jun 2, 2018

I think you can do c_int(c.SOCK_DGRAM).


This comment has been minimized.

hellojoshuatonga commented Jun 5, 2018

@adrusi Any updates? Can we close this now?


This comment has been minimized.


andrewrk commented Jun 5, 2018

@hellojoshuatonga we can leave this open until the zig_panic("TODO") is solved.

@andrewrk andrewrk closed this in 8c77c57 Sep 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment