www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3333] New: std.conv.to!(string, const int) error: cannot modify const

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3333

           Summary: std.conv.to!(string, const int) error: cannot modify
                    const
           Product: D
           Version: 2.032
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: lutger.blijdestijn gmail.com


--- Comment #0 from Lutger <lutger.blijdestijn gmail.com> 2009-09-20 04:45:01
PDT ---
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;

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 20 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3333


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei metalanguage.com
         AssignedTo|nobody puremagic.com        |andrei metalanguage.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 20 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3333


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 03 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3333


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com


--- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2009-10-06
02:22:49 PDT ---
Fixed dmd 2.033

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 06 2009