aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/redundant_ptr_cast.zig
blob: 933eeb2719db94d7418cd70e57b5606d5e896d7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const p: *anyopaque = undefined;
export fn a() void {
    _ = @ptrCast(@ptrCast(p));
}
export fn b() void {
    const ptr1: *u32 = @alignCast(@ptrCast(@alignCast(p)));
    _ = ptr1;
}
export fn c() void {
    _ = @constCast(@alignCast(@ptrCast(@constCast(@volatileCast(p)))));
}

// error
// backend=stage2
// target=native
//
// :3:18: error: redundant @ptrCast
// :6:44: error: redundant @alignCast
// :10:40: error: redundant @constCast