[Issue 6954] New: std.conv.to!int doesn't work in CTFE
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Nov 15 11:40:40 PST 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6954
Summary: std.conv.to!int doesn't work in CTFE
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: minor
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: thecybershadow at gmail.com
--- Comment #0 from Vladimir Panteleev <thecybershadow at gmail.com> 2011-11-15 11:39:54 PST ---
The reason it doesn't work is scope(exit).
Looking at the code[1], it doesn't look like the scope(exit) is really
necessary here (I don't see why it should catch exceptions thrown by parse), so
until there's scope(...) CTFE support, a simple fix would be to rewrite the
code as:
auto result = parse!T(v);
if (v.length)
convError!(SV, T)(v);
return result;
[1]:
https://github.com/D-Programming-Language/phobos/blob/master/std/conv.d#L1606
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list