Sema: validate empty array init
This commit is contained in:
27
test/cases/compile_errors/array_init_invalid_elem_count.zig
Normal file
27
test/cases/compile_errors/array_init_invalid_elem_count.zig
Normal file
@@ -0,0 +1,27 @@
|
||||
const V = @Vector(8, u8);
|
||||
const A = [8]u8;
|
||||
comptime {
|
||||
var v: V = V{1};
|
||||
_ = v;
|
||||
}
|
||||
comptime {
|
||||
var v: V = V{};
|
||||
_ = v;
|
||||
}
|
||||
comptime {
|
||||
var a: A = A{1};
|
||||
_ = a;
|
||||
}
|
||||
comptime {
|
||||
var a: A = A{};
|
||||
_ = a;
|
||||
}
|
||||
|
||||
// error
|
||||
// backend=stage2
|
||||
// target=native
|
||||
//
|
||||
// :4:17: error: expected 8 vector elements; found 1
|
||||
// :8:17: error: expected 8 vector elements; found 0
|
||||
// :12:17: error: expected 8 array elements; found 1
|
||||
// :16:17: error: expected 8 array elements; found 0
|
||||
Reference in New Issue
Block a user