Skip to content

Generate compilable code for array inits #4326

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

Merged
merged 2 commits into from
Jan 30, 2020
Merged

Conversation

LemonBoy
Copy link
Contributor

The compiler still doesn't like too much the newfangled anonymous arrays
so let's use the old-style declarations.

Closes #4181

@LemonBoy LemonBoy closed this Jan 30, 2020
@LemonBoy LemonBoy reopened this Jan 30, 2020
@andrewrk
Copy link
Member

sr.ht has shit the bed, but there is also a legitimate failure here:

========= Expected to find: ===================
pub const uuid_t = [16]u8;
pub const UUID_NULL: uuid_t = .{
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
};
========= But file does not contain it: =======
pub const uuid_t = [16]u8;
pub const UUID_NULL: uuid_t = [16]u8{
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
    @bitCast(u8, @truncate(i8, @as(c_int, 0))),
};

I think you will catch this locally with test-translate-c

The compiler still doesn't like too much the newfangled anonymous arrays
so let's use the old-style declarations.

Closes ziglang#4181
@LemonBoy
Copy link
Contributor Author

sr.ht has shit the bed, but there is also a legitimate failure here:

I routinely forget to git add the test cases once I modify them, sorry for the delay.

@andrewrk andrewrk merged commit 13f7824 into ziglang:master Jan 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected error: duplicate struct field: '0' in translated C code
2 participants