www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15737] New: forward reference error in std.format

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

          Issue ID: 15737
           Summary: forward reference error in std.format
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: john.loughran.colvin gmail.com

struct S
{
    Object ca;

    void foo() const
    {
        import std.stdio;
        writeln(this);
    }
}

causes this error:

/Users/john/Git/phobos/std/format.d(2912): Error: template instance
std.format.formatObject!(LockingTextWriter, const(Object), char) does not match
template declaration formatObject(Writer, T, Char)(ref Writer w, ref T val, ref
FormatSpec!Char f) if (hasToString!(T, Char))
/Users/john/Git/phobos/std/format.d(2645): Error: template instance
std.format.formatValue!(LockingTextWriter, const(Object), char) error
instantiating
/Users/john/Git/phobos/std/format.d(3164):        instantiated from here:
formatElement!(LockingTextWriter, const(Object), char)
/Users/john/Git/phobos/std/format.d(3477):        instantiated from here:
formatValue!(LockingTextWriter, const(S), char)
/Users/john/Git/phobos/std/format.d(467):        instantiated from here:
formatGeneric!(LockingTextWriter, const(S), char)
/Users/john/Git/phobos/std/stdio.d(1298):        ... (1 instantiations, -v to
show) ...
/Users/john/Git/phobos/std/stdio.d(3095):        instantiated from here:
write!(const(S), char)
test.d(8):        instantiated from here: writeln!(const(S))
/Users/john/Git/phobos/std/format.d(470): Error: forward reference to inferred
return type of function call (ref arg)
{
return cast(const(void*))&arg;
}
(_param_2)
/Users/john/Git/phobos/std/format.d(546): Error: template instance
std.format.formatNth!(LockingTextWriter, char, const(S)) error instantiating
/Users/john/Git/phobos/std/stdio.d(1298):        instantiated from here:
formattedWrite!(LockingTextWriter, char, const(S))
/Users/john/Git/phobos/std/stdio.d(3095):        instantiated from here:
write!(const(S), char)
test.d(8):        instantiated from here: writeln!(const(S))

--
Mar 01 2016