diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-01-28 12:32:39 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-01-28 12:32:39 -0500 |
| commit | e0000c47bd22c7b351247b72a85ca26c1c2ada96 (patch) | |
| tree | b90f6afb040e5dbe4d65f7f17ea76d469a36f6c7 /src/codegen.cpp | |
| parent | 5c55a9b4e8d6d1f5ee3548cf8033e7e69951b308 (diff) | |
| download | zig-e0000c47bd22c7b351247b72a85ca26c1c2ada96.tar.gz zig-e0000c47bd22c7b351247b72a85ca26c1c2ada96.zip | |
fix regression of storing optional with 0-bit payload
Diffstat (limited to 'src/codegen.cpp')
| -rw-r--r-- | src/codegen.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index 2eb5e45083..f749b21008 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -4731,6 +4731,10 @@ static LLVMValueRef ir_render_optional_unwrap_ptr(CodeGen *g, IrExecutableGen *e LLVMPositionBuilderAtEnd(g->builder, ok_block); } if (!type_has_bits(child_type)) { + if (instruction->initializing) { + LLVMValueRef non_null_bit = LLVMConstInt(LLVMInt1Type(), 1, false); + gen_store_untyped(g, non_null_bit, base_ptr, 0, false); + } return nullptr; } else { bool is_scalar = !handle_is_ptr(maybe_type); |
