[Issue 3715] New: std.string.format can't use const/immutable toString functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jan 17 09:11:30 PST 2010


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

           Summary: std.string.format can't use const/immutable toString
                    functions
           Product: D
           Version: 2.036
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: tomeksowi at gmail.com


--- Comment #0 from Tomasz Sowiński <tomeksowi at gmail.com> 2010-01-17 09:11:29 PST ---
Test case:

struct A {
    string toString() const {
        return "A";
    }
}

void main() {
    writeln(format("%s", A()));
}

Outputs:
std.format.FormatError: std.format Can't convert test.A to string: "string
toStr
ing()" not defined

Same for immutable.

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