https://d.puremagic.com/issues/show_bug.cgi?id=11921
Summary: dmd doesn't like expressions in templates, only values
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Andrew Pennebaker <[email protected]> 2014-01-13
12:20:39 PST ---
I want to parse a substring into an integer. I try:
ios7crypt.d:
...
string hash = "104306170e120b";
auto seed = parse!(int)(hash[0..2]);
...
But dmd complains:
ios7crypt.d(68): Error: template std.conv.parse does not match any function
template declaration.
To get around this, I can separate parsing into two steps.
ios7crypt.d:
...
string hash = "104306170e120b";
string seed_str = hash[0..2];
auto seed = parse!(int)(seed_str);
...
The second snippet compiles and runs. I just wish I didn't have to do this;
that the template syntax could handle nested expressions.
Full source, in case anyone would like more context:
https://github.com/mcandre/ios7crypt/tree/master/d
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------