Is it a bug, isn’t it?
const Decl = struct {
a: u32,
pub fn init() error{UnreachableError}!Decl {
return .{
.a = 0,
};
}
};
pub fn main() !void {
const a: Decl = .init() catch unreachable; // main.zig:12:22: error: type '@Type(.enum_literal)' not a function
const b: Decl = try .init(); // OK
const c: Decl = Decl.init() catch unreachable; // OK
_ = a;
_ = b;
_ = c;
}
Playground link: