aboutsummaryrefslogtreecommitdiff
path: root/src/Sema.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2023-09-16 00:10:42 +0100
committerAndrew Kelley <andrew@ziglang.org>2023-09-15 21:46:38 -0700
commit6df78c3bc17e5922792fcef0025043c358daa52f (patch)
tree08cef0a28f498b9bd946714d4bc91ddf284fa166 /src/Sema.zig
parent61b70778bdf975957d45432987dde16029aca69a (diff)
downloadzig-6df78c3bc17e5922792fcef0025043c358daa52f.tar.gz
zig-6df78c3bc17e5922792fcef0025043c358daa52f.zip
Sema: mark pointers to inline functions as comptime-only
This is supposed to be the case, similar to how pointers to generic functions are comptime-only (several pieces of logic already assumed this). These types being considered runtime was causing `dbg_var_val` AIR instructions to be wrongly emitted for such values, causing codegen backends to create a runtime reference to the inline function, which (at least on the LLVM backend) triggers an error. Resolves: #38
Diffstat (limited to 'src/Sema.zig')
-rw-r--r--src/Sema.zig2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index 16bf872419..4475cfc008 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -36506,7 +36506,7 @@ pub fn typeRequiresComptime(sema: *Sema, ty: Type) CompileError!bool {
.ptr_type => |ptr_type| {
const child_ty = ptr_type.child.toType();
switch (child_ty.zigTypeTag(mod)) {
- .Fn => return mod.typeToFunc(child_ty).?.is_generic,
+ .Fn => return !try sema.fnHasRuntimeBits(child_ty),
.Opaque => return false,
else => return sema.typeRequiresComptime(child_ty),
}