ability to compare booleans
parent
d1fa5692c6
commit
8ec109de3c
|
@ -1543,7 +1543,8 @@ static LLVMValueRef gen_cmp_expr(CodeGen *g, AstNode *node) {
|
|||
zig_unreachable();
|
||||
}
|
||||
} else if (op1_type->id == TypeTableEntryIdPureError ||
|
||||
op1_type->id == TypeTableEntryIdPointer)
|
||||
op1_type->id == TypeTableEntryIdPointer ||
|
||||
op1_type->id == TypeTableEntryIdBool)
|
||||
{
|
||||
LLVMIntPredicate pred = cmp_op_to_int_predicate(node->data.bin_op_expr.bin_op, false);
|
||||
return LLVMBuildICmp(g->builder, pred, val1, val2, "");
|
||||
|
|
|
@ -1368,3 +1368,11 @@ error NoMem;
|
|||
error CrappedOut;
|
||||
#static_eval_enable(false)
|
||||
fn returns_ten() -> %i32 { 10 }
|
||||
|
||||
|
||||
#attribute("test")
|
||||
fn bool_cmp() {
|
||||
assert(test_bool_cmp(true, false) == false);
|
||||
}
|
||||
#static_eval_enable(false)
|
||||
fn test_bool_cmp(a: bool, b: bool) -> bool { a == b }
|
||||
|
|
Loading…
Reference in New Issue