We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
0.11.0-dev.1280+4b3291764
test "switch sizeof" { switch (0) { @sizeOf(struct {}) => {}, else => unreachable, } }
Produces the following error:
thread 27953 panic: reached unreachable code Analyzing sizeof.zig: sizeof.zig:test.switch sizeof %3 = dbg_block_begin() %4 = dbg_stmt(2, 5) %5 = switch_cond(@Zir.Inst.Ref.zero) node_offset:2:13 to :2:14 %6 = dbg_stmt(2, 13) %7 = typeof(%5) node_offset:2:13 to :2:14 %9 = extended(struct_decl(anon, Auto, {}, {}, {}) node_offset:3:17 to :3:26 %10 = size_of(%9) node_offset:3:9 to :3:27 %11 = as_node(%7, %10) node_offset:3:9 to :3:27 > %8 = switch_block(%5, else => { %18 = dbg_block_begin() %19 = dbg_stmt(4, 17) %20 = unreachable() node_offset:4:17 to :4:28 %21 = dbg_block_end() }, %11 => { %12 = dbg_block_begin() %13 = block({ %14 = restore_err_ret_index(%13, @Zir.Inst.Ref.none) %15 = break(%13, @Zir.Inst.Ref.void_value) }) node_offset:3:31 to :3:33 %16 = dbg_block_end() %17 = break(%8, @Zir.Inst.Ref.void_value) }) node_offset:2:5 to :2:11 %22 = ensure_result_used(%8) node_offset:2:5 to :2:11 %23 = dbg_block_end() %24 = restore_err_ret_index(%2, @Zir.Inst.Ref.none) %25 = break(%2, @Zir.Inst.Ref.void_value) For full context, use the command zig ast-check -t sizeof.zig in sizeof.zig: sizeof.zig:test.switch sizeof > %2 = block({%3..%25}) node_offset:1:22 to :1:23 /home/yorhel/src/zig-src/lib/std/debug.zig:281:14: 0x7da946 in assert (zig) if (!ok) unreachable; // assertion failure ^ /home/yorhel/src/zig-src/src/type.zig:2497:63: 0xc4fa72 in hasRuntimeBitsAdvanced (zig) .eager => assert(struct_obj.haveFieldTypes()), ...
Successful compilation,
The text was updated successfully, but these errors were encountered:
Sema: resolve lazy values in switch prong items
957d17e
Closes ziglang#14330
f2170cb
c5a1f3c
96e69b5
8b35f09
No branches or pull requests
Zig Version
0.11.0-dev.1280+4b3291764
Steps to Reproduce and Observed Behavior
Produces the following error:
Expected Behavior
Successful compilation,
The text was updated successfully, but these errors were encountered: