authorgravatar for 51471119+So1aric@users.noreply.github.comSo1aric <51471119+So1aric@users.noreply.github.com> 2025-11-13 03:21:28+08:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2025-11-12 19:21:28+00:00
log49e19fc94fe70cecc1cba21a04c1f2f1c1e4deb8
tree88c3423ba0e7a02a162955199b63065b1309f9ce
parentbe2a902784dd26199ada0409a5d32e9f5443752a
signaturebadge-check Signed by PGP key B5690EEEBB952194

Sema: fix inline fn compiler crash (#25586)

Resolves: https://github.com/ziglang/zig/issues/25581

2 files changed, 12 insertions(+), 3 deletions(-)

src/Sema.zig+1-3
...@@ -25528,9 +25528,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A...@@ -25528,9 +25528,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
25528 extra_index += 1;25528 extra_index += 1;
25529 if (extra.data.bits.ret_ty_is_generic) break :blk .generic_poison;25529 if (extra.data.bits.ret_ty_is_generic) break :blk .generic_poison;
2553025530
25531 const ret_ty_air_ref = try sema.resolveInst(ret_ty_ref);25531 break :blk try sema.resolveType(block, ret_src, ret_ty_ref);
25532 const ret_ty_val = try sema.resolveConstDefinedValue(block, ret_src, ret_ty_air_ref, .{ .simple = .function_ret_ty });
25533 break :blk ret_ty_val.toType();
25534 } else .void;25532 } else .void;
2553525533
25536 const noalias_bits: u32 = if (extra.data.bits.has_any_noalias) blk: {25534 const noalias_bits: u32 = if (extra.data.bits.has_any_noalias) blk: {
test/cases/compile_errors/value_as_inline_fn_return_type.zig created+11
...@@ -0,0 +1,11 @@
1inline fn a() null {
2 return null;
3}
4
5pub fn main() void {
6 _ = a();
7}
8
9// error
10//
11// :1:15: error: expected type 'type', found '@TypeOf(null)'