www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6955] New: Immutable Strings -> Doubles Fails At Runtime

reply d-bugmail puremagic.com writes:
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



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: -------
Nov 15 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6955




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: -------
Nov 16 2011
prev sibling parent d-bugmail puremagic.com writes:
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



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: -------
Jan 21 2013