authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-06-21 00:58:18-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-06-21 00:58:18-04:00
log4f21dc8a80d7b190d1812a668eaf570d377d95bf
treeb92d76a63f2cd7edbb4cd8e3eedf19b9475c283c
parent708f153288ffa1aabb03c30b6a3a7898e27e92a0
signaturelock-open Commit is signed but in an unrecognized format.

fix regression with zero sized array

thanks mikdusan!

2 files changed, 11 insertions(+), 0 deletions(-)

src/ir.cpp+3
......@@ -15200,6 +15200,9 @@ static IrInstruction *ir_resolve_result(IrAnalyze *ira, IrInstruction *suspend_s
1520015200 return unwrapped_err_ptr;
1520115201 }
1520215202 }
15203 } else if (is_slice(actual_elem_type) && value_type->id == ZigTypeIdArray) {
15204 // need to allow EndExpr to do the implicit cast from array to slice
15205 result_loc_pass1->written = false;
1520315206 }
1520415207 return result_loc;
1520515208}
test/stage1/behavior/misc.zig+8
......@@ -698,3 +698,11 @@ test "unicode escape in character literal" {
698698 var a: u24 = '\U01f4a9';
699699 expect(a == 128169);
700700}
701
702test "result location zero sized array inside struct field implicit cast to slice" {
703 const E = struct {
704 entries: []u32,
705 };
706 var foo = E{ .entries = [_]u32{} };
707 expect(foo.entries.len == 0);
708}