diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-03-12 01:21:10 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-03-12 01:21:10 -0400 |
| commit | 1bf2810f338a7bf83455266ef66a535bdc1d4f83 (patch) | |
| tree | c7abc8f4a0a6b0fed5621051ce2a02d3ec9a0835 /src/ir.cpp | |
| parent | 49c3922037ef0b913466e707d85a4e085f6e9716 (diff) | |
| download | zig-1bf2810f338a7bf83455266ef66a535bdc1d4f83.tar.gz zig-1bf2810f338a7bf83455266ef66a535bdc1d4f83.zip | |
fix comptime slicing not preserving comptime mutability
* fix comptime slice of slice not preserving mutatibility
of the comptime data
* fix comptime slice of pointer not preserving mutability
of the comptime data
closes #826
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 69b955aef7..a52aaa2086 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -15995,6 +15995,10 @@ static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructio init_const_ptr_array(ira->codegen, ptr_val, array_val, index, is_const); if (array_type->id == TypeTableEntryIdArray) { ptr_val->data.x_ptr.mut = ptr_ptr->value.data.x_ptr.mut; + } else if (is_slice(array_type)) { + ptr_val->data.x_ptr.mut = parent_ptr->data.x_ptr.mut; + } else if (array_type->id == TypeTableEntryIdPointer) { + ptr_val->data.x_ptr.mut = parent_ptr->data.x_ptr.mut; } } else if (ptr_is_undef) { ptr_val->type = get_pointer_to_type(ira->codegen, parent_ptr->type->data.pointer.child_type, |
