Skip to content

missing compile error for modification of comptime value in runtime branch #906

@tgschultz

Description

@tgschultz
fn valGetMax(comptime T: type) usize {
    var t = @typeId(T);
    
    var s = switch(t) {
        builtin.TypeId.Float => 32,
        else => @maxValue(T),
    };
    
    return s;
}


test "type" {
    var x = valGetMax(i32);
    x = valGetMax(f64);
}
TODO analyze_min_max_value float

I imagine other builtins will have the same problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions