aboutsummaryrefslogtreecommitdiff
path: root/src/Sema.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-07-21 15:16:59 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-07-21 15:19:56 -0700
commit25f3be32db148c2816547c75462285ae8f5e99eb (patch)
treefa8d29a65b4c85737161180394a1357acb32ead1 /src/Sema.zig
parentfc6e111b76764ae00e2c868ad46f39235837e239 (diff)
downloadzig-25f3be32db148c2816547c75462285ae8f5e99eb.tar.gz
zig-25f3be32db148c2816547c75462285ae8f5e99eb.zip
Sema: fix fn pointer align disagrees with fn align error
Check the specified function alignment rather than the effective function alignment.
Diffstat (limited to 'src/Sema.zig')
-rw-r--r--src/Sema.zig6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index 63e4c46f9b..ce14b2ae45 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -14209,8 +14209,10 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
if (inst_data.size != .One) {
return sema.fail(block, elem_ty_src, "function pointers must be single pointers", .{});
}
- const fn_align = elem_ty.abiAlignment(target);
- if (inst_data.flags.has_align and abi_align != 0 and abi_align != fn_align) {
+ const fn_align = elem_ty.fnInfo().alignment;
+ if (inst_data.flags.has_align and abi_align != 0 and fn_align != 0 and
+ abi_align != fn_align)
+ {
return sema.fail(block, align_src, "function pointer alignment disagrees with function alignment", .{});
}
} else if (inst_data.size == .Many and elem_ty.zigTypeTag() == .Opaque) {