authorgravatar for jhc@dismail.deJimmi Holst Christensen <jhc@dismail.de> 2018-07-04 11:29:02+02:00
committergravatar for jhc@dismail.deJimmi Holst Christensen <jhc@dismail.de> 2018-07-04 11:29:02+02:00
log4f32b86142bec636b9d6be7b72d02b836120eb35
tree2cb368ca00434565e42839c35a946e27e2bf3a8d
parent291afcf75ab458e54a8ccd78dfd1531debfd2e40

Allow allocation of any 0 sized type (not just void)


1 files changed, 1 insertions(+), 1 deletions(-)

std/mem.zig+1-1
......@@ -34,7 +34,7 @@ pub const Allocator = struct {
3434 /// Call `destroy` with the result
3535 pub fn create(self: *Allocator, init: var) Error!*@typeOf(init) {
3636 const T = @typeOf(init);
37 if (@sizeOf(T) == 0) return &{};
37 if (@sizeOf(T) == 0) return &T{};
3838 const slice = try self.alloc(T, 1);
3939 const ptr = &slice[0];
4040 ptr.* = init;