Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std.builtin.FnArg should be comptime? #9429

Open
SrMordred opened this issue Jul 21, 2021 · 1 comment
Open

std.builtin.FnArg should be comptime? #9429

SrMordred opened this issue Jul 21, 2021 · 1 comment
Labels
bug Observed behavior contradicts documented or intended behavior standard library This issue involves writing Zig code for the standard library.
Milestone

Comments

@SrMordred
Copy link

fn f1() void {}
fn f2(x:u32) u32 { return x; }

fn main() void {
    //fine
    const T = @typeInfo( @TypeOf(f1) ); 
    print("{any}", .{T});

    //values of type 'std.builtin.FnArg' must be comptime known, but index value is runtime known
    const T = @typeInfo( @TypeOf(f2) );
    print("{any}", .{T});
}

@SpexGuy SpexGuy added bug Observed behavior contradicts documented or intended behavior standard library This issue involves writing Zig code for the standard library. labels Jul 21, 2021
@SpexGuy
Copy link
Contributor

SpexGuy commented Jul 21, 2021

This is a bug in std.fmt, it has failed to recognize that a value is comptime only and is trying to format it at runtime.

@Vexu Vexu added this to the 0.9.0 milestone Aug 6, 2021
@andrewrk andrewrk modified the milestones: 0.9.0, 0.10.0 Nov 24, 2021
@andrewrk andrewrk modified the milestones: 0.10.0, 0.11.0 Apr 16, 2022
@andrewrk andrewrk modified the milestones: 0.11.0, 0.12.0 Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

No branches or pull requests

4 participants