aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/ptr_coerced_to_slice.zig
blob: 2b96f830648fd460fe647187cf3335858b99a333 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
export fn foo() void {
    const ptr: [*]const u8 = "abc";
    _ = @as([]const u8, ptr);
}
export fn bar() void {
    const ptr: [*c]const u8 = "def";
    _ = @as([]const u8, ptr);
}
export fn baz() void {
    const ptr: *const u8 = &@as(u8, 123);
    _ = @as([]const u8, ptr);
}

// error
// backend=stage2
// target=native
//
// :3:25: error: expected type '[]const u8', found '[*]const u8'
// :7:25: error: expected type '[]const u8', found '[*c]const u8'
// :11:25: error: expected type '[]const u8', found '*const u8'