[Issue 23268] New: clamp no longer accepts shorts

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jul 22 20:03:16 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=23268

          Issue ID: 23268
           Summary: clamp no longer accepts shorts
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: temtaime at gmail.com

import std.algorithm.comparison;

void main()
{
   clamp(short.init, short.init, cast(const)short.init);
}

2.067.1 to 2.098.1: Success and no output
Since      2.099.1: Failure with output:
-----
onlineapp.d(5): Error: none of the overloads of template
`std.algorithm.comparison.clamp` are callable using argument types `!()(short,
short, const(short))`
/path/to/dmd.linux/dmd2/linux/bin64/../../src/phobos/std/algorithm/comparison.d(579):
       Candidate is: `clamp(T1, T2, T3)(T1 val, T2 lower, T3 upper)`
  with `T1 = short,
       T2 = short,
       T3 = const(short)`
  must satisfy the following constraint:
`       is(typeof(val.lessThan(lower) ? lower : val.greaterThan(upper) ? upper
: val) : T1)`
-----

--


More information about the Digitalmars-d-bugs mailing list