www.digitalmars.com         C & C++   DMDScript  

D.gnu - [Issue 2] New: Structs with toString() method not formatted properly

http://gdcproject.org/bugzilla/show_bug.cgi?id=2


           Summary: Structs with toString() method not formatted properly
    Classification: Unclassified
           Product: GDC
           Version: development
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: Normal
         Component: libgphobos
        AssignedTo: ibuclaw gdcproject.org
        ReportedBy: alex lycus.org


$ cat test.d
import std.string;

struct S
{
    string toString() { return "foo"; }
}

void main()
{
    format("%s", S());
}
$ gdc test.d
$ ./a.out 
std.format.FormatException ../../../gcc-4.8-20120701/libphobos/std/format.d(4748):
cannot portably format a struct on this target
----------------
./a.out() [0x43aa10]
./a.out() [0x4238c3]
./a.out() [0x4239b1]
./a.out() [0x402502]
./a.out() [0x405be1]
./a.out() [0x40608d]
./a.out() [0x406140]
./a.out() [0x40608d]
./a.out() [0x40666c]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7f29b9bb430d]
./a.out() [0x402385]
----------------

This program should print "foo".

-- 
Configure issuemail: http://gdcproject.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all issue changes.
Jul 15 2012