mirror of
https://github.com/ziglang/zig.git
synced 2024-11-28 08:02:32 +00:00
ability to compare booleans
This commit is contained in:
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
Block a user