aboutsummaryrefslogtreecommitdiff
path: root/src/Sema.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-11-16 00:31:09 +0200
committerVeikka Tuominen <git@vexu.eu>2022-11-16 01:12:54 +0200
commitfe6249348f615c975a2db53bb0c93f83bd2a281b (patch)
treee059a560361900c2d6e0d226be20cebc9ea0c74e /src/Sema.zig
parentfb09093d95f2dc9bf454ba0d1d489316311adffc (diff)
downloadzig-fe6249348f615c975a2db53bb0c93f83bd2a281b.tar.gz
zig-fe6249348f615c975a2db53bb0c93f83bd2a281b.zip
Sema: ensure comptime reference to function points to original decl
This prevents sema from creating new decls for the functions and passing them to the backends as non-function decls. Closes #12501
Diffstat (limited to 'src/Sema.zig')
-rw-r--r--src/Sema.zig7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index 4b37fc603a..454722728b 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -27404,6 +27404,13 @@ fn analyzeRef(
const operand_ty = sema.typeOf(operand);
if (try sema.resolveMaybeUndefVal(operand)) |val| {
+ switch (val.tag()) {
+ .extern_fn, .function => {
+ const decl_index = val.pointerDecl().?;
+ return sema.analyzeDeclRef(decl_index);
+ },
+ else => {},
+ }
var anon_decl = try block.startAnonDecl();
defer anon_decl.deinit();
return sema.analyzeDeclRef(try anon_decl.finish(