Is this a known compiler crash?

Ran into this compiler crash. Should I open a issue?

const std = @import("std");

const Foo = enum(u32) {
    empty = std.math.maxInt(@typeInfo(@This()).@"enum".tag_type),
    _,
};

test {
    std.debug.print("value: {}\n", .{@intFromEnum(Foo.empty)});
}

Crashes with 0.15.2 and 0.16.0-dev.2736+3b515fbed

This is fixed. Try 0.16.0-dev.2821+3edaef9e0 and you’ll get a delightful error message instead of a crash.

test.zig:4:29: error: type 'crash.Foo' depends on itself for type information query here
    empty = std.math.maxInt(@typeInfo(@This()).@"enum".tag_type),

Presumably fixed by https://codeberg.org/ziglang/zig/pulls/31403

2 Likes