From 315d4e84425ddff888de8d464f657981e4c45da7 Mon Sep 17 00:00:00 2001 From: Veikka Tuominen Date: Sat, 26 Feb 2022 18:06:06 +0200 Subject: stage2: do not require function when evaluating typeOf We only care about the instructions type; it will never actually be codegen'd. --- src/Sema.zig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Sema.zig b/src/Sema.zig index eca88f8922..41398016e5 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -13427,7 +13427,7 @@ fn zirBuiltinExtern( } fn requireFunctionBlock(sema: *Sema, block: *Block, src: LazySrcLoc) !void { - if (sema.func == null) { + if (sema.func == null and !block.is_typeof) { return sema.fail(block, src, "instruction illegal outside function body", .{}); } } @@ -14194,7 +14194,8 @@ fn fieldCallBind( if (first_param_tag == .var_args_param or first_param_tag == .generic_poison or ( first_param_type.zigTypeTag() == .Pointer and - first_param_type.ptrSize() == .One and + (first_param_type.ptrSize() == .One or + first_param_type.ptrSize() == .C) and first_param_type.childType().eql(concrete_ty))) { // zig fmt: on -- cgit v1.2.3