Sema: validate function pointer alignment
This commit is contained in:
committed by
Andrew Kelley
parent
76e7959a90
commit
d851b24180
25
test/cases/compile_errors/function_ptr_alignment.zig
Normal file
25
test/cases/compile_errors/function_ptr_alignment.zig
Normal file
@@ -0,0 +1,25 @@
|
||||
comptime {
|
||||
var a: *align(2) @TypeOf(foo) = undefined;
|
||||
_ = a;
|
||||
}
|
||||
fn foo() void {}
|
||||
|
||||
comptime {
|
||||
var a: *align(1) fn () void = undefined;
|
||||
_ = a;
|
||||
}
|
||||
comptime {
|
||||
var a: *align(2) fn () align(2) void = undefined;
|
||||
_ = a;
|
||||
}
|
||||
comptime {
|
||||
var a: *align(2) fn () void = undefined;
|
||||
_ = a;
|
||||
}
|
||||
|
||||
// error
|
||||
// backend=stage2
|
||||
// target=native
|
||||
//
|
||||
// :2:19: error: function pointer alignment disagrees with function alignment
|
||||
// :16:19: error: function pointer alignment disagrees with function alignment
|
||||
Reference in New Issue
Block a user