diff options
| author | Jimmi HC <jhc@liab.dk> | 2018-07-04 11:29:02 +0200 |
|---|---|---|
| committer | Jimmi HC <jhc@liab.dk> | 2018-07-04 11:29:02 +0200 |
| commit | 4f32b86142bec636b9d6be7b72d02b836120eb35 (patch) | |
| tree | 2cb368ca00434565e42839c35a946e27e2bf3a8d /std | |
| parent | 291afcf75ab458e54a8ccd78dfd1531debfd2e40 (diff) | |
| download | zig-4f32b86142bec636b9d6be7b72d02b836120eb35.tar.gz zig-4f32b86142bec636b9d6be7b72d02b836120eb35.zip | |
Allow allocation of any 0 sized type (not just void)
Diffstat (limited to 'std')
| -rw-r--r-- | std/mem.zig | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/std/mem.zig b/std/mem.zig index ba59faf711..bfd74669f2 100644 --- a/std/mem.zig +++ b/std/mem.zig @@ -34,7 +34,7 @@ pub const Allocator = struct { /// Call `destroy` with the result pub fn create(self: *Allocator, init: var) Error!*@typeOf(init) { const T = @typeOf(init); - if (@sizeOf(T) == 0) return &{}; + if (@sizeOf(T) == 0) return &T{}; const slice = try self.alloc(T, 1); const ptr = &slice[0]; ptr.* = init; |
