zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

test_unresolved_comptime_value.zig (291B) - Raw


      1 fn max(comptime T: type, a: T, b: T) T {
      2     return if (a > b) a else b;
      3 }
      4 test "try to pass a runtime type" {
      5     foo(false);
      6 }
      7 fn foo(condition: bool) void {
      8     const result = max(if (condition) f32 else u64, 1234, 5678);
      9     _ = result;
     10 }
     11 
     12 // test_error=unable to resolve comptime value