[Issue 6955] New: Immutable Strings -> Doubles Fails At Runtime

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 15 12:05:28 PST 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 at puremagic.com
        ReportedBy: dsimcha at yahoo.com


--- Comment #0 from David Simcha <dsimcha at 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: -------


More information about the Digitalmars-d-bugs mailing list