master
1// Note: One of the error messages here is backwards. It would be nice to fix, but that's not
2// going to stop me from merging this branch which fixes a bunch of other stuff.
3export fn entry1(ptr: [*:255]u8) [*:0]u8 {
4 return ptr;
5}
6export fn entry2(ptr: [*]u8) [*:0]u8 {
7 return ptr;
8}
9export fn entry3() void {
10 var array: [2:0]u8 = [_:255]u8{ 1, 2 };
11 _ = &array;
12}
13export fn entry4() void {
14 var array: [2:0]u8 = [_]u8{ 1, 2 };
15 _ = &array;
16}
17
18// error
19//
20// :4:12: error: expected type '[*:0]u8', found '[*:255]u8'
21// :4:12: note: pointer sentinel '255' cannot cast into pointer sentinel '0'
22// :3:34: note: function return type declared here
23// :7:12: error: expected type '[*:0]u8', found '[*]u8'
24// :7:12: note: destination pointer requires '0' sentinel
25// :6:30: note: function return type declared here
26// :10:35: error: expected type '[2:0]u8', found '[2:255]u8'
27// :10:35: note: array sentinel '255' cannot cast into array sentinel '0'
28// :14:31: error: expected type '[2:0]u8', found '[2]u8'
29// :14:31: note: destination array requires '0' sentinel