zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit ab4c461b76ff7b1d10e6d2010370ea0984f97efe (tree)
parent 1ede3af9f6e5923ed1e42cb33e60c0403539c221
Author: Bogdan Romanyuk <65823030+wrongnull@users.noreply.github.com>
Date:   Mon, 24 Jun 2024 03:43:09 +0300

std.mem.zeroes: explicit compile error for @Type(.EnumLiteral)


Diffstat:
Mlib/std/mem.zig | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/std/mem.zig b/lib/std/mem.zig @@ -224,7 +224,7 @@ pub fn zeroes(comptime T: type) T { .ComptimeInt, .Int, .ComptimeFloat, .Float => { return @as(T, 0); }, - .Enum, .EnumLiteral => { + .Enum => { return @as(T, @enumFromInt(0)); }, .Void => { @@ -291,6 +291,7 @@ pub fn zeroes(comptime T: type) T { } @compileError("Can't set a " ++ @typeName(T) ++ " to zero."); }, + .EnumLiteral, .ErrorUnion, .ErrorSet, .Fn,