zig icon indicating copy to clipboard operation
zig copied to clipboard

stage2: error when reifying Fn type via @Type

Open chwkrvn opened this issue 3 years ago • 1 comments

Zig Version

0.10.0-dev.3355+dfc7493dc

Steps to Reproduce

The below code compiles and runs as expected on stage1, however the build fails on stage2:

const std = @import("std");

pub fn main() anyerror!void {
    const fn_info = std.builtin.Type{
        .Fn = .{
            .calling_convention = .C,
            .alignment = 0,
            .is_generic = false,
            .is_var_args = false,
            .return_type = void,
            .args = &.{}
        }
    };

    const fn_type = @Type(fn_info);
    try std.testing.expectEqual(fn() callconv(.C) void, fn_type);
}

zig build run

Expected Behavior

compile and run with the test passing.

Actual Behavior

stage1 works flawlessly, however stage2 outputs the following error when attempting to build:

error: TODO: Sema.zirReify for Fn
    const fn_type = @Type(fn_info);
                    ^~~~~~~~~~~~~~

chwkrvn avatar Jul 28 '22 21:07 chwkrvn

if it is not worthwhile for me to file bugs of this sort (stage1/2 behavior differences) plz let me know :)

chwkrvn avatar Jul 28 '22 22:07 chwkrvn