www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript
electronics



digitalmars.D.bugs - [Issue 1110] New: std.format.doFormat + struct without toString() == crash

↑ ↓ ← d-bugmail puremagic.com writes:
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.


-- 
Apr 08 2007
↑ ↓ → d-bugmail puremagic.com writes:
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.


-- 
Apr 08 2007