mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
Sema: take dbg_stmt into account in zirResolveInferredAlloc
This commit is contained in:
parent
83beed09e1
commit
febc7d3cd6
@ -2976,7 +2976,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com
|
|||||||
|
|
||||||
// Even though we reuse the constant instruction, we still remove it from the
|
// Even though we reuse the constant instruction, we still remove it from the
|
||||||
// block so that codegen does not see it.
|
// block so that codegen does not see it.
|
||||||
block.instructions.shrinkRetainingCapacity(block.instructions.items.len - 3);
|
block.instructions.shrinkRetainingCapacity(search_index);
|
||||||
sema.air_values.items[value_index] = try Value.Tag.decl_ref.create(sema.arena, new_decl_index);
|
sema.air_values.items[value_index] = try Value.Tag.decl_ref.create(sema.arena, new_decl_index);
|
||||||
// if bitcast ty ref needs to be made const, make_ptr_const
|
// if bitcast ty ref needs to be made const, make_ptr_const
|
||||||
// ZIR handles it later, so we can just use the ty ref here.
|
// ZIR handles it later, so we can just use the ty ref here.
|
||||||
|
|||||||
@ -977,3 +977,13 @@ test "weird array and tuple initializations" {
|
|||||||
.b = if (a) .{ .e = .a } else .{ .e = .b },
|
.b = if (a) .{ .e = .a } else .{ .e = .b },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test "array type comes from generic function" {
|
||||||
|
const S = struct {
|
||||||
|
fn A() type {
|
||||||
|
return struct { a: u8 = 0 };
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const args = [_]S.A(){.{}};
|
||||||
|
_ = args;
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user