aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/function_ptr_alignment.zig
blob: cf97e61f40147ef636bd7536d9a6cab0783a6b71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
fn align1() align(1) void {}
fn align2() align(2) void {}

comptime {
    _ = @as(*align(1) const fn () void, &align2);
    _ = @as(*align(1) const fn () void, &align1);
    _ = @as(*align(2) const fn () void, &align2);
    _ = @as(*align(2) const fn () void, &align1);
}

// error
// backend=stage2
// target=native
//
// :8:41: error: expected type '*align(2) const fn () void', found '*const fn () void'
// :8:41: note: pointer alignment '1' cannot cast into pointer alignment '2'