| author | |
| committer | |
| log | 673a1efa228f1e28317c202b8ab9135afb9ed2a2 |
| tree | 1cc2c251fb44892ddeb3fa2d4bb606f7de3b692d |
| parent | b1730880894493d7cd9b1b7bc06e49c9120ca7b6 |
| signature |
Resolves: #180072 files changed, 7 insertions(+), 1 deletions(-)
src/Sema.zig+1-1| ... | ... | @@ -26089,7 +26089,7 @@ fn fieldVal( |
| 26089 | 26089 | const ptr_info = object_ty.ptrInfo(mod); |
| 26090 | 26090 | const result_ty = try sema.ptrType(.{ |
| 26091 | 26091 | .child = ptr_info.child.toType().childType(mod).toIntern(), |
| 26092 | .sentinel = ptr_info.sentinel, | |
| 26092 | .sentinel = if (inner_ty.sentinel(mod)) |s| s.toIntern() else .none, | |
| 26093 | 26093 | .flags = .{ |
| 26094 | 26094 | .size = .Many, |
| 26095 | 26095 | .alignment = ptr_info.flags.alignment, |
test/behavior/string_literals.zig+6| ... | ... | @@ -74,3 +74,9 @@ test "@src() returns a struct containing 0-terminated string slices" { |
| 74 | 74 | const ptr_src_fn_name: [*:0]const u8 = src.fn_name; |
| 75 | 75 | _ = ptr_src_fn_name; // unused |
| 76 | 76 | } |
| 77 | ||
| 78 | test "string literal pointer sentinel" { | |
| 79 | const string_literal = "something"; | |
| 80 | ||
| 81 | try std.testing.expect(@TypeOf(string_literal.ptr) == [*:0]const u8); | |
| 82 | } |