diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-02-26 18:06:06 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-02-26 18:08:31 +0200 |
| commit | 315d4e84425ddff888de8d464f657981e4c45da7 (patch) | |
| tree | 6c5f4bf623b276963cec98ebbf713d2a752e9e01 /src/Sema.zig | |
| parent | ff72b8a8194573bc1d7f95cbf3228b363194c775 (diff) | |
| download | zig-315d4e84425ddff888de8d464f657981e4c45da7.tar.gz zig-315d4e84425ddff888de8d464f657981e4c45da7.zip | |
stage2: do not require function when evaluating typeOf
We only care about the instructions type; it will never actually be codegen'd.
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 5 |
1 files changed, 3 insertions, 2 deletions
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 |
