authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-06-18 10:49:21-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-06-18 10:49:21-04:00
logfdc6e0af056e72ee47a296e7d8fbb365dc00c058
tree50226b0ba024289d6c1eccee5c014e29c1009509
parente5a0414b05134bfebba4fba097ae882ee0cf36cf
signature Commit is signed but in an unrecognized format.

fix zero length array literal casted to slice


1 files changed, 14 insertions(+), 2 deletions(-)

src/ir.cpp+14-2
...@@ -15119,8 +15119,11 @@ static IrInstruction *ir_analyze_instruction_resolve_result(IrAnalyze *ira, IrIn...@@ -15119,8 +15119,11 @@ static IrInstruction *ir_analyze_instruction_resolve_result(IrAnalyze *ira, IrIn
15119 old_result_loc = reinterpret_cast<ResultLocPeer *>(instruction->result_loc)->parent->parent;15119 old_result_loc = reinterpret_cast<ResultLocPeer *>(instruction->result_loc)->parent->parent;
15120 continue;15120 continue;
15121 }15121 }
15122 ir_assert(false, &instruction->base); // TODO15122 IrInstruction *result = ir_const(ira, &instruction->base, implicit_elem_type);
15123 zig_unreachable();15123 result->value.special = ConstValSpecialUndef;
15124 IrInstruction *ptr = ir_get_ref(ira, &instruction->base, result, false, false);
15125 ptr->value.data.x_ptr.mut = ConstPtrMutComptimeVar;
15126 return ptr;
15124 }15127 }
15125}15128}
1512615129
...@@ -19212,6 +19215,15 @@ static IrInstruction *ir_analyze_instruction_container_init_list(IrAnalyze *ira,...@@ -19212,6 +19215,15 @@ static IrInstruction *ir_analyze_instruction_container_init_list(IrAnalyze *ira,
19212 return ira->codegen->invalid_instruction;19215 return ira->codegen->invalid_instruction;
19213 }19216 }
1921419217
19218 switch (type_has_one_possible_value(ira->codegen, container_type)) {
19219 case OnePossibleValueInvalid:
19220 return ira->codegen->invalid_instruction;
19221 case OnePossibleValueYes:
19222 return ir_const(ira, &instruction->base, container_type);
19223 case OnePossibleValueNo:
19224 break;
19225 }
19226
19215 bool is_comptime;19227 bool is_comptime;
19216 switch (type_requires_comptime(ira->codegen, container_type)) {19228 switch (type_requires_comptime(ira->codegen, container_type)) {
19217 case ReqCompTimeInvalid:19229 case ReqCompTimeInvalid: