Commit 6fc71835c3

Veikka Tuominen <git@vexu.eu>
2022-10-27 23:07:38
value: properly hash `null_value` pointer
Closes #13325
1 parent c3b85e4
Changed files (2)
src
test
behavior
src/value.zig
@@ -2621,6 +2621,7 @@ pub const Value = extern union {
 
             .zero,
             .one,
+            .null_value,
             .int_u64,
             .int_i64,
             .int_big_positive,
test/behavior/generics.zig
@@ -396,3 +396,12 @@ test "slice as parameter type" {
     try expect(S.internComptimeString(source_a[1..2]) == S.internComptimeString(source_a[1..2]));
     try expect(S.internComptimeString(source_a[2..4]) != S.internComptimeString(source_a[5..7]));
 }
+
+test "null sentinel pointer passed as generic argument" {
+    const S = struct {
+        fn doTheTest(a: anytype) !void {
+            try std.testing.expect(@ptrToInt(a) == 8);
+        }
+    };
+    try S.doTheTest((@intToPtr([*:null]const [*c]const u8, 8)));
+}