aboutsummaryrefslogtreecommitdiff
path: root/src/Sema.zig
diff options
context:
space:
mode:
authorBogdan Romanyuk <65823030+wrongnull@users.noreply.github.com>2023-11-23 05:08:15 +0300
committerGitHub <noreply@github.com>2023-11-23 02:08:15 +0000
commitaa31096cbd0d66d7c31e12eebe91f36293346dba (patch)
tree7908a5ffa180b1539c3d77dfd6336f90904e06be /src/Sema.zig
parente4977f3e89fcc164a4d02cd38eb066cfe1a1124f (diff)
downloadzig-aa31096cbd0d66d7c31e12eebe91f36293346dba.tar.gz
zig-aa31096cbd0d66d7c31e12eebe91f36293346dba.zip
Sema: disallow call to undefined function
Diffstat (limited to 'src/Sema.zig')
-rw-r--r--src/Sema.zig3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index a15699c867..5a55b9d097 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -7132,6 +7132,9 @@ fn analyzeCall(
const callee_ty = sema.typeOf(func);
const func_ty_info = mod.typeToFunc(func_ty).?;
const cc = func_ty_info.cc;
+ if (try sema.resolveValue(func)) |func_val|
+ if (func_val.isUndef(mod))
+ return sema.failWithUseOfUndef(block, call_src);
if (cc == .Naked) {
const maybe_decl = try sema.funcDeclSrc(func);
const msg = msg: {