[Issue 24075] New: Can't use toChars with `ushort` or `ubyte`
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Aug 6 16:36:54 UTC 2023
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: nobody at puremagic.com
Reporter: grimmaple95 at 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`
```
--
More information about the Digitalmars-d-bugs
mailing list