aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-11-27 01:31:09 -0500
committerAndrew Kelley <superjoe30@gmail.com>2016-11-27 01:31:09 -0500
commite5325c7ef3c5b0fe9afbcba59cd269608d65dda0 (patch)
tree31de00fbdf19690efff218b55ac79d0adc30c571 /src/ir.cpp
parentd9329ed389e4454c631772674beee459c7783069 (diff)
downloadzig-e5325c7ef3c5b0fe9afbcba59cd269608d65dda0.tar.gz
zig-e5325c7ef3c5b0fe9afbcba59cd269608d65dda0.zip
IR: fix not checking for error in unary bool not
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 20fb30cbcc..33980b6127 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -4012,10 +4012,14 @@ static TypeTableEntry *ir_analyze_instruction_call(IrAnalyze *ira, IrInstruction
}
static TypeTableEntry *ir_analyze_unary_bool_not(IrAnalyze *ira, IrInstructionUnOp *un_op_instruction) {
+ IrInstruction *value = un_op_instruction->value->other;
+ if (value->type_entry->id == TypeTableEntryIdInvalid)
+ return ira->codegen->builtin_types.entry_invalid;
+
TypeTableEntry *bool_type = ira->codegen->builtin_types.entry_bool;
- IrInstruction *casted_value = ir_get_casted_value(ira, un_op_instruction->value->other, bool_type);
- if (casted_value == ira->codegen->invalid_instruction)
+ IrInstruction *casted_value = ir_get_casted_value(ira, value, bool_type);
+ if (casted_value->type_entry->id == TypeTableEntryIdInvalid)
return ira->codegen->builtin_types.entry_invalid;
ConstExprValue *operand_val = &casted_value->static_value;