[Issue 8326] New: std.string.format results in run-time exception

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jun 30 11:16:46 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8326

           Summary: std.string.format results in run-time exception
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: puneet at coverify.org


--- Comment #0 from Puneet Goel <puneet at coverify.org> 2012-06-30 11:19:22 PDT ---
std.string.format throws runtime exception for BigInt and for BitArray types
even though writefln works fine. The run-time error says 
std.format.FormatException at std/format.d(4744): Can't convert std.bigint.BigInt
to string: "string toString()" not defined

Here is a small test case:


void main()
{
  import std.stdio;
  import std.string;
  import std.bigint;
  import std.bitmanip;

  BigInt aa = 100;

  BitArray bb;
  bb.init([true, false]);

  writefln("%x", aa);
  writefln("%x", bb);
  writeln(format("%x", aa)); // throws exception
  writeln(format("%x", bb)); // throws exception
}

-- 
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