fix implicit cast vector to array
This commit is contained in:
parent
c61e0a078c
commit
cb55803a59
|
@ -12283,6 +12283,9 @@ static IrInstruction *ir_analyze_vector_to_array(IrAnalyze *ira, IrInstruction *
|
|||
result->value.type = array_type;
|
||||
return result;
|
||||
}
|
||||
if (result_loc == nullptr) {
|
||||
result_loc = no_result_loc();
|
||||
}
|
||||
IrInstruction *result_loc_inst = ir_resolve_result(ira, source_instr, result_loc, array_type, nullptr, true, false);
|
||||
if (type_is_invalid(result_loc_inst->value.type) || instr_is_unreachable(result_loc_inst)) {
|
||||
return result_loc_inst;
|
||||
|
|
|
@ -61,3 +61,16 @@ test "vector bit operators" {
|
|||
S.doTheTest();
|
||||
comptime S.doTheTest();
|
||||
}
|
||||
|
||||
test "implicit cast vector to array" {
|
||||
const S = struct {
|
||||
fn doTheTest() void {
|
||||
var a: @Vector(4, i32) = [_]i32{ 1, 2, 3, 4 };
|
||||
var result_array: [4]i32 = a;
|
||||
result_array = a;
|
||||
expect(mem.eql(i32, result_array, [4]i32{ 1, 2, 3, 4 }));
|
||||
}
|
||||
};
|
||||
S.doTheTest();
|
||||
comptime S.doTheTest();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user