aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/array_init_invalid_elem_count.zig
blob: d61987479dcca19cb11aaf22e498518c20d044c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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;
}
pub export fn entry1() void {
    var bla: V = .{ 1, 2, 3, 4 };
    _ = bla;
}
pub export fn entry2() void {
    var bla: A = .{ 1, 2, 3, 4 };
    _ = bla;
}

// 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
// :20:19: error: expected 8 vector elements; found 4
// :24:19: error: expected 8 array elements; found 4