Bug 3333 – std.conv.to!(string, const int) error: cannot modify const

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2009-09-20T04:45:00Z
Last change time
2015-06-09T01:26:47Z
Assigned to
andrei
Creator
lutger.blijdestijn

Comments

Comment #0 by lutger.blijdestijn — 2009-09-20T04:45:01Z
import std.conv; void main() { assert( to!string( cast(const int)1) == "1" ); } errors: src/phobos/std/conv.d(2580): Error: variable std.conv.to!(immutable(char)[],const(int)).to.u cannot modify const src/phobos/std/conv.d(5): Error: template instance std.conv.to!(immutable(char) [],const(int)) error instantiating Possible fix: @@ -2570,11 +2570,11 @@ return to!T(cast(Unsigned!(S)) value); alias Unqual!(ElementType!T) Char; Char[1 + S.sizeof * 3] buffer; - auto u = -cast(Unsigned!S) value; + Unqual!S u = -cast(Unsigned!S) value; uint ndigits = 1; while (u) { immutable c = cast(char)((u % 10) + '0'); u /= 10;
Comment #1 by bugzilla — 2009-10-06T02:22:49Z
Fixed dmd 2.033