mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
Sema: fix inline fn compiler crash (#25586)
Resolves: https://github.com/ziglang/zig/issues/25581
This commit is contained in:
parent
be2a902784
commit
49e19fc94f
@ -25528,9 +25528,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
|
|||||||
extra_index += 1;
|
extra_index += 1;
|
||||||
if (extra.data.bits.ret_ty_is_generic) break :blk .generic_poison;
|
if (extra.data.bits.ret_ty_is_generic) break :blk .generic_poison;
|
||||||
|
|
||||||
const ret_ty_air_ref = try sema.resolveInst(ret_ty_ref);
|
break :blk try sema.resolveType(block, ret_src, ret_ty_ref);
|
||||||
const ret_ty_val = try sema.resolveConstDefinedValue(block, ret_src, ret_ty_air_ref, .{ .simple = .function_ret_ty });
|
|
||||||
break :blk ret_ty_val.toType();
|
|
||||||
} else .void;
|
} else .void;
|
||||||
|
|
||||||
const noalias_bits: u32 = if (extra.data.bits.has_any_noalias) blk: {
|
const noalias_bits: u32 = if (extra.data.bits.has_any_noalias) blk: {
|
||||||
|
|||||||
11
test/cases/compile_errors/value_as_inline_fn_return_type.zig
Normal file
11
test/cases/compile_errors/value_as_inline_fn_return_type.zig
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
inline fn a() null {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn main() void {
|
||||||
|
_ = a();
|
||||||
|
}
|
||||||
|
|
||||||
|
// error
|
||||||
|
//
|
||||||
|
// :1:15: error: expected type 'type', found '@TypeOf(null)'
|
||||||
Loading…
x
Reference in New Issue
Block a user