| author | |
| committer | |
| log | 8583fd7f9f96887fe685354662b1fc076ebeb031 |
| tree | f919b325871f0251429461bff039d9e7714bbae6 |
| parent | 8ad75a9bf3a7fa9782bf17165fa6d7dc842efb51 |
see #1452 files changed, 14 insertions(+), 1 deletions(-)
src/codegen.cpp+3-1| ... | @@ -1480,7 +1480,9 @@ static LLVMValueRef gen_cmp_expr(CodeGen *g, AstNode *node) { | ... | @@ -1480,7 +1480,9 @@ static LLVMValueRef gen_cmp_expr(CodeGen *g, AstNode *node) { |
| 1480 | } else { | 1480 | } else { |
| 1481 | zig_unreachable(); | 1481 | zig_unreachable(); |
| 1482 | } | 1482 | } |
| 1483 | } else if (op1_type->id == TypeTableEntryIdPureError) { | 1483 | } else if (op1_type->id == TypeTableEntryIdPureError || |
| 1484 | op1_type->id == TypeTableEntryIdPointer) | ||
| 1485 | { | ||
| 1484 | LLVMIntPredicate pred = cmp_op_to_int_predicate(node->data.bin_op_expr.bin_op, false); | 1486 | LLVMIntPredicate pred = cmp_op_to_int_predicate(node->data.bin_op_expr.bin_op, false); |
| 1485 | return LLVMBuildICmp(g->builder, pred, val1, val2, ""); | 1487 | return LLVMBuildICmp(g->builder, pred, val1, val2, ""); |
| 1486 | } else { | 1488 | } else { |
test/self_hosted.zig+11| ... | @@ -1322,3 +1322,14 @@ fn pass_slice_of_empty_struct_to_fn() { | ... | @@ -1322,3 +1322,14 @@ fn pass_slice_of_empty_struct_to_fn() { |
| 1322 | fn test_pass_slice_of_empty_struct_to_fn(slice: []EmptyStruct2) -> isize { | 1322 | fn test_pass_slice_of_empty_struct_to_fn(slice: []EmptyStruct2) -> isize { |
| 1323 | slice.len | 1323 | slice.len |
| 1324 | } | 1324 | } |
| 1325 | |||
| 1326 | |||
| 1327 | #attribute("test") | ||
| 1328 | fn pointer_comparison() { | ||
| 1329 | const a = ([]u8)("a"); | ||
| 1330 | const b = &a; | ||
| 1331 | assert(ptr_eql(b, b)); | ||
| 1332 | } | ||
| 1333 | fn ptr_eql(a: &[]u8, b: &[]u8) -> bool { | ||
| 1334 | a == b | ||
| 1335 | } |