| author | |
| committer | |
| log | 9d16839420c674fd7dff0b28b3efcc9a7953ed74 |
| tree | d1b2157bcf9b9a5cb713fe6c580ee8b3ce5a12d5 |
| parent | 508fdfea7227bf8c201134bf0b8c2b9c1c3ff787 |
| signature |
closes #25783 files changed, 14 insertions(+), 1 deletions(-)
src/codegen.cpp+1-1| ... | ... | @@ -2002,7 +2002,7 @@ static LLVMValueRef ir_llvm_value(CodeGen *g, IrInstruction *instruction) { |
| 2002 | 2002 | render_const_val_global(g, &instruction->value, ""); |
| 2003 | 2003 | ZigType *ptr_type = get_pointer_to_type(g, instruction->value.type, true); |
| 2004 | 2004 | instruction->llvm_value = LLVMBuildBitCast(g->builder, instruction->value.global_refs->llvm_global, get_llvm_type(g, ptr_type), ""); |
| 2005 | } else if (instruction->value.type->id == ZigTypeIdPointer) { | |
| 2005 | } else if (get_codegen_ptr_type(instruction->value.type) != nullptr) { | |
| 2006 | 2006 | instruction->llvm_value = LLVMBuildBitCast(g->builder, instruction->value.global_refs->llvm_value, |
| 2007 | 2007 | get_llvm_type(g, instruction->value.type), ""); |
| 2008 | 2008 | } else { |
test/stage1/behavior.zig+1| ... | ... | @@ -26,6 +26,7 @@ comptime { |
| 26 | 26 | _ = @import("behavior/bugs/2006.zig"); |
| 27 | 27 | _ = @import("behavior/bugs/2114.zig"); |
| 28 | 28 | _ = @import("behavior/bugs/2346.zig"); |
| 29 | _ = @import("behavior/bugs/2578.zig"); | |
| 29 | 30 | _ = @import("behavior/bugs/394.zig"); |
| 30 | 31 | _ = @import("behavior/bugs/421.zig"); |
| 31 | 32 | _ = @import("behavior/bugs/529.zig"); |
test/stage1/behavior/bugs/2578.zig created+12| ... | ... | @@ -0,0 +1,12 @@ |
| 1 | const Foo = struct { | |
| 2 | y: u8, | |
| 3 | }; | |
| 4 | ||
| 5 | var foo: Foo = undefined; | |
| 6 | const t = &foo; | |
| 7 | ||
| 8 | fn bar(pointer: ?*c_void) void {} | |
| 9 | ||
| 10 | test "fixed" { | |
| 11 | bar(t); | |
| 12 | } |