diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-06-09 00:12:57 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-09 00:12:57 -0400 |
| commit | 9ee98f103b3c8eb7f5775943725af4d38da36d2c (patch) | |
| tree | 4651c6234b85de6d7c5b3b5f8f7f14789d95af1f /src/ir.cpp | |
| parent | 748158277441343e9b54c56e2b9e0725833a43ce (diff) | |
| parent | c0c9d11d8c509fdd1e60492abb1215d9860c3d39 (diff) | |
| download | zig-9ee98f103b3c8eb7f5775943725af4d38da36d2c.tar.gz zig-9ee98f103b3c8eb7f5775943725af4d38da36d2c.zip | |
Merge pull request #5539 from mikdusan/issue5474
stage1: fix constness in some corner cases
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 3583f6ff05..a733f282b5 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -21924,7 +21924,9 @@ static IrInstGen *ir_analyze_struct_field_ptr(IrAnalyze *ira, IrInst* source_ins case OnePossibleValueYes: { IrInstGen *elem = ir_const_move(ira, source_instr, get_the_one_possible_value(ira->codegen, field_type)); - return ir_get_ref(ira, source_instr, elem, false, false); + return ir_get_ref(ira, source_instr, elem, + struct_ptr->value->type->data.pointer.is_const, + struct_ptr->value->type->data.pointer.is_volatile); } case OnePossibleValueNo: break; @@ -27097,10 +27099,8 @@ static IrInstGen *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstSrcSlice *i if (array_type->id == ZigTypeIdArray) { elem_type = array_type->data.array.child_type; - bool is_comptime_const = ptr_ptr->value->special == ConstValSpecialStatic && - ptr_ptr->value->data.x_ptr.mut == ConstPtrMutComptimeConst; non_sentinel_slice_ptr_type = get_pointer_to_type_extra(ira->codegen, elem_type, - ptr_ptr_type->data.pointer.is_const || is_comptime_const, + ptr_ptr_type->data.pointer.is_const, ptr_ptr_type->data.pointer.is_volatile, PtrLenUnknown, ptr_ptr_type->data.pointer.explicit_alignment, 0, 0, false); |
