| author | |
| committer | |
| log | cbc85f4516a5bd545ce365dedec19f6fcad47b58 |
| tree | 85034338c6861eec5217b328fe358e3a4e4d3777 |
| parent | 75c33ba85e47eec9f7257cfb972a54b22a5283eb |
3 files changed, 14 insertions(+), 0 deletions(-)
src/stage1/ir.cpp+1| ... | ... | @@ -21575,6 +21575,7 @@ done_with_return_type: |
| 21575 | 21575 | // handle `[N]T` |
| 21576 | 21576 | target_len = target->type->data.array.len; |
| 21577 | 21577 | target_sentinel = target->type->data.array.sentinel; |
| 21578 | expand_undef_array(ira->codegen, target); | |
| 21578 | 21579 | target_elements = target->data.x_array.data.s_none.elements; |
| 21579 | 21580 | break; |
| 21580 | 21581 | } else if (target->type->id == ZigTypeIdPointer && target->type->data.pointer.child_type->id == ZigTypeIdArray) { |
test/behavior.zig+1| ... | ... | @@ -83,6 +83,7 @@ test { |
| 83 | 83 | _ = @import("behavior/bugs/11181.zig"); |
| 84 | 84 | _ = @import("behavior/bugs/11213.zig"); |
| 85 | 85 | _ = @import("behavior/bugs/12003.zig"); |
| 86 | _ = @import("behavior/bugs/12033.zig"); | |
| 86 | 87 | _ = @import("behavior/byteswap.zig"); |
| 87 | 88 | _ = @import("behavior/byval_arg_var.zig"); |
| 88 | 89 | _ = @import("behavior/call.zig"); |
test/behavior/bugs/12033.zig created+12| ... | ... | @@ -0,0 +1,12 @@ |
| 1 | const std = @import("std"); | |
| 2 | ||
| 3 | test { | |
| 4 | const string = "Hello!\x00World!"; | |
| 5 | try std.testing.expect(@TypeOf(string) == *const [13:0]u8); | |
| 6 | ||
| 7 | const slice_without_sentinel: []const u8 = string[0..6]; | |
| 8 | try std.testing.expect(@TypeOf(slice_without_sentinel) == []const u8); | |
| 9 | ||
| 10 | const slice_with_sentinel: [:0]const u8 = string[0..6 :0]; | |
| 11 | try std.testing.expect(@TypeOf(slice_with_sentinel) == [:0]const u8); | |
| 12 | } |