| author | |
| committer | |
| log | 4f21dc8a80d7b190d1812a668eaf570d377d95bf |
| tree | b92d76a63f2cd7edbb4cd8e3eedf19b9475c283c |
| parent | 708f153288ffa1aabb03c30b6a3a7898e27e92a0 |
| signature | Commit is signed but in an unrecognized format. |
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 |
| 15200 | 15200 | return unwrapped_err_ptr; |
| 15201 | 15201 | } |
| 15202 | 15202 | } |
| 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; | |
| 15203 | 15206 | } |
| 15204 | 15207 | return result_loc; |
| 15205 | 15208 | } |
test/stage1/behavior/misc.zig+8| ... | ... | @@ -698,3 +698,11 @@ test "unicode escape in character literal" { |
| 698 | 698 | var a: u24 = '\U01f4a9'; |
| 699 | 699 | expect(a == 128169); |
| 700 | 700 | } |
| 701 | ||
| 702 | test "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 | } |