comptime prefix being treated as comptime block causing inconsistent treatment of unreachable code formulation #20698
Labels
bug
Observed behavior contradicts documented or intended behavior
error message
This issue points out an error message that is unhelpful and should be improved.
frontend
Tokenization, parsing, AstGen, Sema, and Liveness.
Milestone
Zig Version
0.14.0-dev.224+95d9292a7
Steps to Reproduce and Observed Behavior
Consider this code, which yields an unreachable code error:
and then consider this extremely similar, but subtly different, non-erroring code:
it would appear that the ast-check responsible for unreachable control flow treats
comptime expr; expr;
the same as{ expr; } expr;
.While this almost makes sense if you squint your brain, it's very unintuitive and was directly described as a bug by @mlugg, who requested this be made into a bug report.
Expected Behavior
Both snippets should error.
The text was updated successfully, but these errors were encountered: