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

LLVM Basic Block has no termintor error when calling @errorName with @as(error{}, undefined) #19964

Closed
Trevor-Strong opened this issue May 13, 2024 · 2 comments
Labels
bug Observed behavior contradicts documented or intended behavior

Comments

@Trevor-Strong
Copy link

Zig Version

0.12.0

Steps to Reproduce and Observed Behavior

// bug.zig
test {
    const err: error{} = undefined;
    _ = @errorName(err);
}
$ zig test bug.zig
LLVM Emit Object... Basic Block in function 'bug.test_0' does not have terminator!
label %Entry
LLVM ERROR: Broken module found, compilation aborted!

Expected Behavior

I would expect this to not crash the compiler. Ideally this would be a compile error, as the only way this happens is when you call @errorName on an error{} object, and the only way to create an instance of error{} is from coercing undefined. The current behavior of @errorName with non-empty error sets could kept as is.

@Trevor-Strong Trevor-Strong added the bug Observed behavior contradicts documented or intended behavior label May 13, 2024
@wooster0
Copy link
Contributor

Related: #15909

@Vexu
Copy link
Member

Vexu commented May 19, 2024

Covered by #13807 and #15909

@Vexu Vexu closed this as not planned Won't fix, can't repro, duplicate, stale May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

3 participants