Summary: writeln doesn't take custom toString into account
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: Phobos

--- Comment #0 from Andrej Mitrovic <> 2012-03-03 
17:11:49 PST ---
import std.stdio;

struct Foo {
    string toString(bool x) { return ""; }

void main()
    Foo foo;
    writeln(foo.toString());  // nogo: ok
    writeln(foo);  // compiles

The second writeln() call shouldn't compile. It seems writeln uses a default
toString if it doesn't find a toString() function that takes exactly zero

Note that it will call the custom toString if 'x' has a default argument.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to