zig
zig copied to clipboard
compiler segmentation fault when mismatched declared array size to actual values
Zig Version
0.10.0-dev.4253+fa9327ac0
Steps to Reproduce
- Given this file
crash.zig
pub fn main() !void {
const x: [2]i8 = .{0};
_ = x;
}
- Run the command
zig build-exe crash.zig
Expected Behavior
A compiler error: expected 2 array elements; found 1
Actual Behavior
segmentation fault
Workaround for now is simply to write const x = [2]i8 {0};
Also crashes when vec size is mismatched.
pub fn main() void {
const foo: @Vector(3, u8) = .{ 0, 1 };
_ = foo;
}
Still an issue on 0.11.0-dev.18+81c27677d