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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 12 15:43:09 UTC 2023


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 at puremagic.com
          Reporter: dkorpel at 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."

--


More information about the Digitalmars-d-bugs mailing list