aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/mem.zig3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/std/mem.zig b/lib/std/mem.zig
index 489fec7ea1..13152496b3 100644
--- a/lib/std/mem.zig
+++ b/lib/std/mem.zig
@@ -276,7 +276,8 @@ pub fn zeroes(comptime T: type) T {
return null;
},
.One, .Many => {
- @compileError("Can't set a non nullable pointer to zero.");
+ if (ptr_info.is_allowzero) return @ptrFromInt(0);
+ @compileError("Only nullable and allowzero pointers can be set to zero.");
},
}
},