| author | |
| committer | |
| log | febc7d3cd63eefe91c7aaa95e3a274a0b44e353e |
| tree | 67ef6d579402767c8c359fabd98f11026a03eac0 |
| parent | 83beed09e1ce5a15e2b9801a50cf601352d8383e |
2 files changed, 11 insertions(+), 1 deletions(-)
src/Sema.zig+1-1| ... | ... | @@ -2976,7 +2976,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com |
| 2976 | 2976 | |
| 2977 | 2977 | // Even though we reuse the constant instruction, we still remove it from the |
| 2978 | 2978 | // block so that codegen does not see it. |
| 2979 | block.instructions.shrinkRetainingCapacity(block.instructions.items.len - 3); | |
| 2979 | block.instructions.shrinkRetainingCapacity(search_index); | |
| 2980 | 2980 | sema.air_values.items[value_index] = try Value.Tag.decl_ref.create(sema.arena, new_decl_index); |
| 2981 | 2981 | // if bitcast ty ref needs to be made const, make_ptr_const |
| 2982 | 2982 | // ZIR handles it later, so we can just use the ty ref here. |
test/behavior/basic.zig+10| ... | ... | @@ -977,3 +977,13 @@ test "weird array and tuple initializations" { |
| 977 | 977 | .b = if (a) .{ .e = .a } else .{ .e = .b }, |
| 978 | 978 | }; |
| 979 | 979 | } |
| 980 | ||
| 981 | test "array type comes from generic function" { | |
| 982 | const S = struct { | |
| 983 | fn A() type { | |
| 984 | return struct { a: u8 = 0 }; | |
| 985 | } | |
| 986 | }; | |
| 987 | const args = [_]S.A(){.{}}; | |
| 988 | _ = args; | |
| 989 | } |