commit e8bad1e12a972ce26aeedd37bf49a6751bab2b76 (tree)
parent 101440c1990de653bbfb19713915d86d7a5bc182
Author: Andrew Kelley <andrew@ziglang.org>
Date: Fri, 23 Aug 2019 17:39:56 -0400
fix regression on `@ptrCast`
this case regressed and now fixed:
```zig
const a: ?*i32 = undefined;
const b: ?*f32 = @ptrCast(?*f32, a);
```
Diffstat:
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/src/ir.cpp b/src/ir.cpp
@@ -23298,12 +23298,7 @@ static IrInstruction *ir_analyze_ptr_cast(IrAnalyze *ira, IrInstruction *source_
if (!val)
return ira->codegen->invalid_instruction;
- if (value_is_comptime(val)) {
- if ((err = ir_resolve_const_val(ira->codegen, ira->new_irb.exec,
- source_instr->source_node, val, UndefBad)))
- {
- return ira->codegen->invalid_instruction;
- }
+ if (value_is_comptime(val) && val->special != ConstValSpecialUndef) {
bool is_addr_zero = val->data.x_ptr.special == ConstPtrSpecialNull ||
(val->data.x_ptr.special == ConstPtrSpecialHardCodedAddr &&
val->data.x_ptr.data.hard_coded_addr.addr == 0);