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

Iterating over void slice hits assert #1203

Closed
Hejsil opened this Issue Jul 6, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@Hejsil
Member

Hejsil commented Jul 6, 2018

test "" {
    var res: []const void = []void{};
    for (res) |_, i| {}
}
zig: zig/src/codegen.cpp:2989: LLVMOpaqueValue* ir_render_elem_ptr(CodeGen*, IrExecutable*, IrInstructionElemPtr*): Assertion `ptr_index != SIZE_MAX' failed.
[1]    13903 abort (core dumped)  zig test test.zig

@andrewrk andrewrk added this to the 0.3.0 milestone Jul 6, 2018

@andrewrk andrewrk added the bug label Jul 6, 2018

@andrewrk andrewrk closed this in 4ad4cd2 Jul 6, 2018

@andrewrk

This comment has been minimized.

Member

andrewrk commented Jul 6, 2018

more idiomatic times function:

fn times(n: usize) []const void {
    return ([*]void)(undefined)[0..n];
} 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment