[Issue 11729] protected toString causes strange error message

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Sep 5 13:42:39 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=11729

anonymous4 <dfj1esp02 at sneakemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic

--- Comment #2 from anonymous4 <dfj1esp02 at sneakemail.com> ---
I suppose something like this:

class A
{
    protected override string toString(){ return null; }
}
void f()
{
    import std.stdio;
    write(new A);
}
std/format.d(3450): Error: template instance
std.format.formatObject!(LockingTextWriter, A, char) does not match template
declaration formatObject(Writer, T, Char)(ref Writer w, ref T val, ref const
FormatSpec!Char f) if (hasToString!(T, Char))

--


More information about the Digitalmars-d-bugs mailing list