| author | |
| committer | |
| log | 3c541d7be38d625645276f8a0dee57774fe94134 |
| tree | dddb742c68b4a1f1b59fad0629d2322b0edade3c |
| parent | 6217b401f94380a0a82aa979bc4ac90e7431267d |
| signature |
3 files changed, 23 insertions(+), 23 deletions(-)
src/ir.cpp+2-2| ... | ... | @@ -16004,7 +16004,7 @@ static IrInstruction *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCallSrc *c |
| 16004 | 16004 | IrInstruction *result_loc; |
| 16005 | 16005 | if (handle_is_ptr(impl_fn_type_id->return_type)) { |
| 16006 | 16006 | result_loc = ir_resolve_result(ira, &call_instruction->base, call_instruction->result_loc, |
| 16007 | impl_fn_type_id->return_type, nullptr, true, false); | |
| 16007 | impl_fn_type_id->return_type, nullptr, true, true); | |
| 16008 | 16008 | if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) { |
| 16009 | 16009 | return result_loc; |
| 16010 | 16010 | } |
| ... | ... | @@ -16124,7 +16124,7 @@ static IrInstruction *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCallSrc *c |
| 16124 | 16124 | IrInstruction *result_loc; |
| 16125 | 16125 | if (handle_is_ptr(return_type)) { |
| 16126 | 16126 | result_loc = ir_resolve_result(ira, &call_instruction->base, call_instruction->result_loc, |
| 16127 | return_type, nullptr, true, false); | |
| 16127 | return_type, nullptr, true, true); | |
| 16128 | 16128 | if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) { |
| 16129 | 16129 | return result_loc; |
| 16130 | 16130 | } |
test/stage1/behavior.zig+1-1| ... | ... | @@ -76,7 +76,7 @@ comptime { |
| 76 | 76 | _ = @import("behavior/sizeof_and_typeof.zig"); |
| 77 | 77 | _ = @import("behavior/slice.zig"); |
| 78 | 78 | _ = @import("behavior/slicetobytes.zig"); |
| 79 | _ = @import("behavior/struct.zig"); // TODO | |
| 79 | _ = @import("behavior/struct.zig"); | |
| 80 | 80 | _ = @import("behavior/struct_contains_null_ptr_itself.zig"); |
| 81 | 81 | _ = @import("behavior/struct_contains_slice_of_itself.zig"); |
| 82 | 82 | _ = @import("behavior/switch.zig"); |
test/stage1/behavior/struct.zig+20-20| ... | ... | @@ -529,26 +529,26 @@ test "access to global struct fields" { |
| 529 | 529 | expect(g_foo.bar.value == 42); |
| 530 | 530 | } |
| 531 | 531 | |
| 532 | //test "packed struct with fp fields" { | |
| 533 | // const S = packed struct { | |
| 534 | // data: [3]f32, | |
| 535 | // | |
| 536 | // pub fn frob(self: *@This()) void { | |
| 537 | // self.data[0] += self.data[1] + self.data[2]; | |
| 538 | // self.data[1] += self.data[0] + self.data[2]; | |
| 539 | // self.data[2] += self.data[0] + self.data[1]; | |
| 540 | // } | |
| 541 | // }; | |
| 542 | // | |
| 543 | // var s: S = undefined; | |
| 544 | // s.data[0] = 1.0; | |
| 545 | // s.data[1] = 2.0; | |
| 546 | // s.data[2] = 3.0; | |
| 547 | // s.frob(); | |
| 548 | // expectEqual(f32(6.0), s.data[0]); | |
| 549 | // expectEqual(f32(11.0), s.data[1]); | |
| 550 | // expectEqual(f32(20.0), s.data[2]); | |
| 551 | //} | |
| 532 | test "packed struct with fp fields" { | |
| 533 | const S = packed struct { | |
| 534 | data: [3]f32, | |
| 535 | ||
| 536 | pub fn frob(self: *@This()) void { | |
| 537 | self.data[0] += self.data[1] + self.data[2]; | |
| 538 | self.data[1] += self.data[0] + self.data[2]; | |
| 539 | self.data[2] += self.data[0] + self.data[1]; | |
| 540 | } | |
| 541 | }; | |
| 542 | ||
| 543 | var s: S = undefined; | |
| 544 | s.data[0] = 1.0; | |
| 545 | s.data[1] = 2.0; | |
| 546 | s.data[2] = 3.0; | |
| 547 | s.frob(); | |
| 548 | expectEqual(f32(6.0), s.data[0]); | |
| 549 | expectEqual(f32(11.0), s.data[1]); | |
| 550 | expectEqual(f32(20.0), s.data[2]); | |
| 551 | } | |
| 552 | 552 | |
| 553 | 553 | test "use within struct scope" { |
| 554 | 554 | const S = struct { |