authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-06-19 23:52:51-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-06-19 23:52:51-04:00
log3c541d7be38d625645276f8a0dee57774fe94134
treedddb742c68b4a1f1b59fad0629d2322b0edade3c
parent6217b401f94380a0a82aa979bc4ac90e7431267d
signaturelock-open Commit is signed but in an unrecognized format.

fix peer result loc fn call with comptime condition


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