master
1export fn entry1() void {
2 var a = .{ 1, 2, 3 };
3 _ = @as([]u8, &a);
4}
5export fn entry2() void {
6 var a = .{ @as(u8, 1), @as(u8, 2), @as(u8, 3) };
7 _ = @as([]u8, &a);
8}
9
10// runtime values
11var vals = [_]u7{ 4, 5, 6 };
12export fn entry3() void {
13 var a = .{ vals[0], vals[1], vals[2] };
14 _ = @as([]u8, &a);
15}
16export fn entry4() void {
17 var a = .{ @as(u8, vals[0]), @as(u8, vals[1]), @as(u8, vals[2]) };
18 _ = @as([]u8, &a);
19}
20
21// error
22//
23// :3:19: error: cannot cast pointer to tuple to '[]u8'
24// :3:19: note: pointers to tuples can only coerce to constant pointers
25// :7:19: error: cannot cast pointer to tuple to '[]u8'
26// :7:19: note: pointers to tuples can only coerce to constant pointers
27// :14:19: error: cannot cast pointer to tuple to '[]u8'
28// :14:19: note: pointers to tuples can only coerce to constant pointers
29// :18:19: error: cannot cast pointer to tuple to '[]u8'
30// :18:19: note: pointers to tuples can only coerce to constant pointers