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

          Issue ID: 24075
           Summary: Can't use toChars with `ushort` or `ubyte`
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nob...@puremagic.com
          Reporter: grimmapl...@gmail.com

There is a weird limitation on `toChars` that only allows it to work with ubyte
and uint:

```
    ubyte a = 123;
    writeln(a.toChars!(16));
```

```
onlineapp.d(6): Error: none of the overloads of template `std.conv.toChars` are
callable using argument types `!(16)(ubyte)`
/dlang/dmd/linux/bin64/../../src/phobos/std/conv.d(5710):        Candidate is:
`toChars(ubyte radix = 10, Char = char, LetterCase letterCase =
LetterCase.lower, T)(T value)`
  with `radix = 16,
       Char = char,
       letterCase = LetterCase.lower,
       T = ubyte`
  must satisfy one of the following constraints:
`       is(immutable(T) == immutable(uint))
       is(immutable(T) == immutable(ulong))
       radix == 10`
```

--

Reply via email to