diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-03-27 15:07:45 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-03-27 15:07:45 -0400 |
| commit | 6cb99fdac3fb02d7e4e5a363295bae0dd3641a45 (patch) | |
| tree | 596dc91fb9208a0507dfb326198756037232906e /src | |
| parent | 0b7b3190fd1121aa4e349740cff1faf213c94411 (diff) | |
| download | zig-6cb99fdac3fb02d7e4e5a363295bae0dd3641a45.tar.gz zig-6cb99fdac3fb02d7e4e5a363295bae0dd3641a45.zip | |
fix crash when compile error in analyzing @panic call
Diffstat (limited to 'src')
| -rw-r--r-- | src/ir.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index d86b7f5b21..ea001adb93 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -16918,18 +16918,18 @@ static TypeTableEntry *ir_analyze_instruction_can_implicit_cast(IrAnalyze *ira, static TypeTableEntry *ir_analyze_instruction_panic(IrAnalyze *ira, IrInstructionPanic *instruction) { IrInstruction *msg = instruction->msg->other; if (type_is_invalid(msg->value.type)) - return ira->codegen->builtin_types.entry_invalid; + return ir_unreach_error(ira); if (ir_should_inline(ira->new_irb.exec, instruction->base.scope)) { ir_add_error(ira, &instruction->base, buf_sprintf("encountered @panic at compile-time")); - return ira->codegen->builtin_types.entry_invalid; + return ir_unreach_error(ira); } TypeTableEntry *u8_ptr_type = get_pointer_to_type(ira->codegen, ira->codegen->builtin_types.entry_u8, true); TypeTableEntry *str_type = get_slice_type(ira->codegen, u8_ptr_type); IrInstruction *casted_msg = ir_implicit_cast(ira, msg, str_type); if (type_is_invalid(casted_msg->value.type)) - return ira->codegen->builtin_types.entry_invalid; + return ir_unreach_error(ira); IrInstruction *new_instruction = ir_build_panic(&ira->new_irb, instruction->base.scope, instruction->base.source_node, casted_msg); |
