diff --git a/lib/std/mem/Allocator.zig b/lib/std/mem/Allocator.zig index bb59de2a7e70710ae10645d8cabeb4b5e1033612..f14373970a80cac639a6d21d25cbf1ac35f9c1ee 100644 --- a/lib/std/mem/Allocator.zig +++ b/lib/std/mem/Allocator.zig @@ -159,7 +159,7 @@ fn moveBytes( /// Returns a pointer to undefined memory. /// Call `destroy` with the result to free the memory. pub fn create(self: *Allocator, comptime T: type) Error!*T { - if (@sizeOf(T) == 0) return &(T{}); + if (@sizeOf(T) == 0) return @as(*T, undefined); const slice = try self.allocAdvancedWithRetAddr(T, null, 1, .exact, @returnAddress()); return &slice[0]; }