Bug 7598 – format() doesn't work with alias this

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-02-26T18:23:00Z
Last change time
2012-04-24T04:59:22Z
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2012-02-26T18:23:19Z
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@std\format.d(4400): Can't convert test.Wrap to string: "string toString()" not defined
Comment #1 by lovelydear — 2012-04-20T02:18:41Z
See also issue 7922
Comment #2 by k.hara.pg — 2012-04-20T02:30:27Z
(In reply to comment #1) > See also issue 7922 No, this is std.string.format function problem, then it is Phobos issue. And 7922 is a dmd issue. So they are not related.
Comment #3 by k.hara.pg — 2012-04-24T04:59:22Z
*** This issue has been marked as a duplicate of issue 6595 ***