| author | |
| committer | |
| log | cb55803a59d4fe99b527dc3ffc5674666511f729 |
| tree | a925b3e8bf37daee79077730bb41b87f7cf78c26 |
| parent | c61e0a078cea2a6845ed7b03189409829d2cdf24 |
| signature |
2 files changed, 16 insertions(+), 0 deletions(-)
src/ir.cpp+3| ... | ... | @@ -12283,6 +12283,9 @@ static IrInstruction *ir_analyze_vector_to_array(IrAnalyze *ira, IrInstruction * |
| 12283 | 12283 | result->value.type = array_type; |
| 12284 | 12284 | return result; |
| 12285 | 12285 | } |
| 12286 | if (result_loc == nullptr) { | |
| 12287 | result_loc = no_result_loc(); | |
| 12288 | } | |
| 12286 | 12289 | IrInstruction *result_loc_inst = ir_resolve_result(ira, source_instr, result_loc, array_type, nullptr, true, false); |
| 12287 | 12290 | if (type_is_invalid(result_loc_inst->value.type) || instr_is_unreachable(result_loc_inst)) { |
| 12288 | 12291 | return result_loc_inst; |
test/stage1/behavior/vector.zig+13| ... | ... | @@ -61,3 +61,16 @@ test "vector bit operators" { |
| 61 | 61 | S.doTheTest(); |
| 62 | 62 | comptime S.doTheTest(); |
| 63 | 63 | } |
| 64 | ||
| 65 | test "implicit cast vector to array" { | |
| 66 | const S = struct { | |
| 67 | fn doTheTest() void { | |
| 68 | var a: @Vector(4, i32) = [_]i32{ 1, 2, 3, 4 }; | |
| 69 | var result_array: [4]i32 = a; | |
| 70 | result_array = a; | |
| 71 | expect(mem.eql(i32, result_array, [4]i32{ 1, 2, 3, 4 })); | |
| 72 | } | |
| 73 | }; | |
| 74 | S.doTheTest(); | |
| 75 | comptime S.doTheTest(); | |
| 76 | } |