[Issue 7598] New: format() doesn't work with alias this

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 26 18:23:23 PST 2012


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

           Summary: format() doesn't work with alias this
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-02-26 18:23:19 PST ---
import std.stdio;
import std.string;

struct Wrap
{
    string a;
    alias a this;
}

struct Foo
{
    Wrap wrap;
    string toString() { return format("%s", wrap); }
}

void main()
{
    Foo foo;
    writeln(foo);
}

std.format.FormatException at std\format.d(4400): Can't convert test.Wrap to
string: "string toString()" not defined

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