[Issue 17149] New: to!int("42", 16, LetterCase.lower) does not compile
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Feb 5 21:05:01 PST 2017
https://issues.dlang.org/show_bug.cgi?id=17149
Issue ID: 17149
Summary: to!int("42", 16, LetterCase.lower) does not compile
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: issues.dlang at jmdavisProg.com
This code does not compile.
void main()
{
import std.ascii;
import std.conv;
assert(to!int("42", 16) == 0x42);
assert(to!int("42", 16, LetterCase.lower) == 0x42);
assert(to!int("42", 16, LetterCase.upper) == 0x42);
}
The first to!int call works, but the other two do not. It is clear from the
documentation for std.conv.to that they should. And std.conv.to has this in its
unit tests:
assert(to!string(Int(0x1234BCD), 16u, LetterCase.upper) == "1234BCD");
assert(to!string(Int(0x1234AF), 16u, LetterCase.lower) == "1234af");
So, the problem is likely related to access levels in some way, with required
functions probably being private. Regardless, the results is that you can't
currently give std.conv.to!int a LetterCase argument, forcing all hex literals
to be uppercase. It wouldn't surprise me if this is a regression, but I'm not
in a good position to test that at the moment.
--
More information about the Digitalmars-d-bugs
mailing list