diff options
| author | Bogdan Romanyuk <65823030+wrongnull@users.noreply.github.com> | 2023-11-23 05:08:15 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-23 02:08:15 +0000 |
| commit | aa31096cbd0d66d7c31e12eebe91f36293346dba (patch) | |
| tree | 7908a5ffa180b1539c3d77dfd6336f90904e06be /src/Sema.zig | |
| parent | e4977f3e89fcc164a4d02cd38eb066cfe1a1124f (diff) | |
| download | zig-aa31096cbd0d66d7c31e12eebe91f36293346dba.tar.gz zig-aa31096cbd0d66d7c31e12eebe91f36293346dba.zip | |
Sema: disallow call to undefined function
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 3 |
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: { |
