Thread overview
[Issue 1110] New: std.format.doFormat + struct without toString() == crash
Apr 08, 2007
d-bugmail
Apr 08, 2007
d-bugmail
Jul 30, 2007
d-bugmail
April 08, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1110

           Summary: std.format.doFormat + struct without toString() == crash
           Product: D
           Version: 1.010
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: fvbommel@wxs.nl


When formatting a struct instance, std.format.doFormat doesn't check whether TypeInfo_Struct.xtoString is null before calling it. IMHO it should check for this and throw an exception if it's null.


-- 

April 08, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1110





------- Comment #1 from fvbommel@wxs.nl  2007-04-08 09:43 -------
Created an attachment (id=137)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=137&action=view)
Proposed patch

Adds
=====
if (tis.xtoString is null)
    throw new FormatError("Can't convert " ~ tis.toString() ~ " to string:
\"char[] toString()\" not defined");
=====
when formatting a struct.


-- 

July 30, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1110


bugzilla@digitalmars.com changed:

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




------- Comment #2 from bugzilla@digitalmars.com  2007-07-30 15:48 -------
Fixed DMD 1.019 and 2.003


--