September 14, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6668

           Summary: Wrong "to" conversion stack trace
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: minor
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@eml.cc 2011-09-14 11:18:05 PDT ---
D2 code:


import std.conv;
void main() {
    to!uint("-1");
}



With DMD 2.055 it gives a strange stack trace on Windows (and on one Linux), that I am not sure is correct:


std.conv.ConvException@...\src\phobos\std\conv.d(1809): Can't convert value `-1' of type string to type uint
----------------
...\src\phobos\std\conv.d(1810): uint std.conv.parse!(uint,
immutable(char)[]).parse(ref immutable(char)[])
...\src\phobos\std\conv.d(1643): uint std.conv.toImpl!(uint,
immutable(char)[]).toImpl(immutable(char)[])
...\src\phobos\std\conv.d(234): uint
std.conv.to!(uint).to!(immutable(char)[]).to(immutable(char)[])
...\test.d(3): _Dmain
----------------
std.conv.ConvException@...\src\phobos\std\conv.d(1640): Can't convert value `-1' of type string to type uint
----------------
...\src\phobos\std\conv.d(1640): uint std.conv.toImpl!(uint,
immutable(char)[]).toImpl(immutable(char)[])
...\src\phobos\std\conv.d(234): uint
std.conv.to!(uint).to!(immutable(char)[]).to(immutable(char)[])
...\test.d(3): _Dmain
----------------

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


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

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


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-19 22:13:00 PST ---
It's caused by collateral exceptions due to scope(exit) being used in std.conv which throws it's own exception regardless of any already in flight. I think these should actually be scope(success) instead.

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
           Platform|x86                         |All
         AssignedTo|nobody@puremagic.com        |andrej.mitrovich@gmail.com
         OS/Version|Windows                     |All


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-20 08:31:29 PST ---
https://github.com/D-Programming-Language/phobos/pull/1081

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



--- Comment #3 from github-bugzilla@puremagic.com 2013-01-21 00:23:15 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/88c2c81fbcc8cbc718f1f7bdbf7da017a18a2516 Fixes Issue 6668 - Avoid throwing collateral exceptions in std.conv.to

https://github.com/D-Programming-Language/phobos/commit/8f85f6bdaa985a32773442b8dc1932e1d9796436 Merge pull request #1081 from AndrejMitrovic/Fix6668

Issue 6668 - Avoid throwing collateral exceptions in std.conv.to

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


Alex Rønne Petersen <alex@lycus.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |alex@lycus.org
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Top | Discussion index | About this forum | D home