aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid <87927264+Rexicon226@users.noreply.github.com>2023-11-16 08:08:30 -0800
committerGitHub <noreply@github.com>2023-11-16 16:08:30 +0000
commit673a1efa228f1e28317c202b8ab9135afb9ed2a2 (patch)
tree1cc2c251fb44892ddeb3fa2d4bb606f7de3b692d /test
parentb1730880894493d7cd9b1b7bc06e49c9120ca7b6 (diff)
downloadzig-673a1efa228f1e28317c202b8ab9135afb9ed2a2.tar.gz
zig-673a1efa228f1e28317c202b8ab9135afb9ed2a2.zip
Sema: include sentinel in type of pointer-to-array `ptr` field
Resolves: #18007
Diffstat (limited to 'test')
-rw-r--r--test/behavior/string_literals.zig6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/behavior/string_literals.zig b/test/behavior/string_literals.zig
index 51ca7e997c..04ec145e3f 100644
--- a/test/behavior/string_literals.zig
+++ b/test/behavior/string_literals.zig
@@ -74,3 +74,9 @@ test "@src() returns a struct containing 0-terminated string slices" {
const ptr_src_fn_name: [*:0]const u8 = src.fn_name;
_ = ptr_src_fn_name; // unused
}
+
+test "string literal pointer sentinel" {
+ const string_literal = "something";
+
+ try std.testing.expect(@TypeOf(string_literal.ptr) == [*:0]const u8);
+}