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

Function with empty error set triggers assert in codegen. #818

Closed
Hejsil opened this Issue Mar 7, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@Hejsil
Member

Hejsil commented Mar 7, 2018

test "" {
    _ = a(0);
}

const Error = error{};
fn a(b: usize) Error!usize {
    return b;
}
zig: zig/src/codegen.cpp:1521: LLVMOpaqueValue* gen_assign_raw(CodeGen*, LLVMValueRef, TypeTableEntry*, LLVMValueRef): Assertion `LLVMGetTypeKind(LLVMTypeOf(value)) == LLVMPointerTypeKind' failed.
  • If the parameter b is removed and you don't pass 0, it compiles.
  • If the error set has 1 or more errors, it compiles.

@Hejsil Hejsil added the bug label Mar 8, 2018

@andrewrk

This comment has been minimized.

Member

andrewrk commented Mar 13, 2018

See also #762

@andrewrk andrewrk modified the milestones: 0.2.0, 0.3.0 Mar 13, 2018

@Hejsil

This comment has been minimized.

Member

Hejsil commented Apr 27, 2018

Do we have a workaround for this?

@Hejsil Hejsil closed this in 3178528 Apr 28, 2018

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