www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23268] New: clamp no longer accepts shorts


          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 puremagic.com
          Reporter: temtaime 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))`
       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)`

Jul 22 2022