| author | |
| committer | |
| log | 78d8931647f207965ef98354db67fb880987fafe |
| tree | 4320918a2e9d4c57485bcae9af34de2bdafd1768 |
| parent | 2fde8249b72f22ddfa16793c245315f30c7f3ff8 |
| signature |
* fix issue #5618
* A test for the issue #5618 added.
Also inserted a comma in the neighboring test to make it more zigfmt-friendly.2 files changed, 12 insertions(+), 1 deletions(-)
src/ir.cpp+1| ... | ... | @@ -15452,6 +15452,7 @@ static IrInstGen *ir_analyze_cast(IrAnalyze *ira, IrInst *source_instr, |
| 15452 | 15452 | if (is_pointery_and_elem_is_not_pointery(actual_type)) { |
| 15453 | 15453 | ZigType *dest_ptr_type = nullptr; |
| 15454 | 15454 | if (wanted_type->id == ZigTypeIdPointer && |
| 15455 | actual_type->id != ZigTypeIdOptional && | |
| 15455 | 15456 | wanted_type->data.pointer.child_type == ira->codegen->builtin_types.entry_c_void) |
| 15456 | 15457 | { |
| 15457 | 15458 | dest_ptr_type = wanted_type; |
test/compile_errors.zig+11-1| ... | ... | @@ -7571,6 +7571,16 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 7571 | 7571 | \\ return -y; |
| 7572 | 7572 | \\} |
| 7573 | 7573 | , &[_][]const u8{ |
| 7574 | "tmp.zig:3:12: error: negation of type 'u32'" | |
| 7574 | "tmp.zig:3:12: error: negation of type 'u32'", | |
| 7575 | }); | |
| 7576 | ||
| 7577 | cases.add("Issue #5618: coercion of ?*c_void to *c_void must fail.", | |
| 7578 | \\export fn foo() void { | |
| 7579 | \\ var u: ?*c_void = null; | |
| 7580 | \\ var v: *c_void = undefined; | |
| 7581 | \\ v = u; | |
| 7582 | \\} | |
| 7583 | , &[_][]const u8{ | |
| 7584 | "tmp.zig:4:9: error: expected type '*c_void', found '?*c_void'", | |
| 7575 | 7585 | }); |
| 7576 | 7586 | } |