aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2025-02-22 11:47:22 -0500
committerAndrew Kelley <andrew@ziglang.org>2025-02-22 22:47:32 -0500
commit220f80e71dbcb9dac4ed71845573a95b75299e4c (patch)
treed9ea138fd8c4c56284ad4cb767afb2b07077f3bd /test
parent4b0f77cc1f2f4939c59e92175f6e69394eb3bcef (diff)
downloadzig-220f80e71dbcb9dac4ed71845573a95b75299e4c.tar.gz
zig-220f80e71dbcb9dac4ed71845573a95b75299e4c.zip
Dwarf: fix lowering of comptime-only optional pointer `null` values
Closes #22974
Diffstat (limited to 'test')
-rw-r--r--test/behavior/optional.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/behavior/optional.zig b/test/behavior/optional.zig
index 1f8acfaa39..36e5ba579c 100644
--- a/test/behavior/optional.zig
+++ b/test/behavior/optional.zig
@@ -656,3 +656,14 @@ test "result location initialization of optional with OPV payload" {
_ = &c;
try expectEqual(0, (c orelse return error.TestFailed).x);
}
+
+test "global comptime only optional" {
+ const S = struct {
+ const @"null": ?*type = null;
+ const @"void": ?*const type = &void;
+ };
+ comptime {
+ assert(S.null == null);
+ assert(S.void.?.* == void);
+ }
+}