Thread overview
[Issue 6955] New: Immutable Strings -> Doubles Fails At Runtime
Nov 15, 2011
David Simcha
Nov 17, 2011
David Simcha
Jan 22, 2013
Andrej Mitrovic
November 15, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6955

           Summary: Immutable Strings -> Doubles Fails At Runtime
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: dsimcha@yahoo.com


--- Comment #0 from David Simcha <dsimcha@yahoo.com> 2011-11-15 12:04:42 PST ---
import std.stdio, std.conv;

void main() {
    immutable val = "2";
    to!double(val);
}

std.conv.ConvException@/home/dsimcha/dmd2/linux/bin64/../../src/phobos/std/conv.d(1749): Can't convert value `2' of type string to type double
----------------
./test(double std.conv.toImpl!(double,
immutable(char[])).toImpl(immutable(char[]))+0x74) [0x425e34]
./test(_Dmain+0x15) [0x4235c1]
./test(extern (C) int rt.dmain2.main(int, char**).void runMain()+0x17)
[0x428cc7]
./test(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void
delegate())+0x2a) [0x42886e]
./test(extern (C) int rt.dmain2.main(int, char**).void runAll()+0x42)
[0x428d1a]
./test(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void
delegate())+0x2a) [0x42886e]
./test(main+0xd3) [0x4287ff]
/lib/libc.so.6(__libc_start_main+0xfd) [0x7f09c9b48c4d]

This goes away if I change `immutable val` to `auto val`.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 17, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6955



--- Comment #1 from David Simcha <dsimcha@yahoo.com> 2011-11-16 18:04:01 PST ---
This only happens with -O, so it's a codegen bug.  I'll work on creating a test case for the underlying codegen bug in a separate report.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 22, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=6955


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-21 18:51:30 PST ---
Can't reproduce in 2.061. Please verify and close with WORKSFORME if fixed.

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