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
extern fn bar() void; export fn foo() void { defer bar(); defer return; }
stage1 gives the correct result:
./test.zig:5:11: error: cannot return from defer expression defer return; ^
stage2 does not catch the problem. It should be caught in AstGen:
[nix-shell:~/dev/zig/build-release]$ ./zig-out/bin/zig astgen test.zig # Source bytes: 83B # Tokens: 24 (144B) # AST Nodes: 12 (276B) # Total ZIR bytes: 414B # Instructions: 16 (144B) # String Table Bytes: 10B # Extra Data Items: 49 (196B) %15 = extended(struct_decl(parent, Auto, { [35] bar line(0) hash(a136708cffc080900b4d0ec55ba4898f): %0 = block_inline({ %1 = extended(func([], @Ref.void_type, cc=@Ref.calling_convention_c, extern, {}) node_offset:1:8 %2 = break_inline(%0, %1) }) node_offset:1:8 [42] export foo line(2) hash(29d6f5fbb9c6edc9aaf52cebc6e0ab46): %3 = block_inline({ %13 = func([], @Ref.void_type, { %4 = dbg_stmt(2, 10) %5 = dbg_stmt(1, 10) %6 = decl_val("bar") token_offset:4:11 %7 = call_chkused(%6, []) node_offset:4:14 %8 = ret_node(@Ref.void_value) node_offset:5:11 %9 = dbg_stmt(1, 10) %10 = decl_val("bar") token_offset:4:11 %11 = call_chkused(%10, []) node_offset:4:14 %12 = ret_coerce(@Ref.void_value) token_offset:6:1 }) (lbrace=0:21,rbrace=3:0) node_offset:3:8 %14 = break_inline(%3, %13) }) node_offset:3:8 }, {}, {})
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
stage1 gives the correct result:
stage2 does not catch the problem. It should be caught in AstGen:
The text was updated successfully, but these errors were encountered: