aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/passing_an_under-aligned_function_pointer.zig
blob: 6d3e2e871d1410b419cc939efe761d3b6d543099 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
export fn entry() void {
    testImplicitlyDecreaseFnAlign(alignedSmall, 1234);
}
fn testImplicitlyDecreaseFnAlign(ptr: *const fn () align(8) i32, answer: i32) void {
    if (ptr() != answer) unreachable;
}
fn alignedSmall() align(4) i32 {
    return 1234;
}

// error
// backend=stage2
// target=x86_64-linux
//
// :2:35: error: expected type '*const fn() align(8) i32', found '*const fn() align(4) i32'
// :2:35: note: pointer alignment '4' cannot cast into pointer alignment '8'