www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24278] New: std.math.abs promotes unsigned argument to 32 bits

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

          Issue ID: 24278
           Summary: std.math.abs promotes unsigned argument to 32 bits
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: dkorpel live.nl

```D
import std.math;  
void main()
{
     assert(is(typeof(abs(ubyte(8u))) == ubyte));
}
```

The assert fails, while the documentation says "the return type will be the
same as the input."

--
Dec 12 2023