[Issue 7763] New: No template instantiation backtrace printed trying to use writefln on a const or immutable object reference

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 24 17:51:49 PDT 2012


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

           Summary: No template instantiation backtrace printed trying to
                    use writefln on a const or immutable object reference
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: smjg at iname.com


--- Comment #0 from Stewart Gordon <smjg at iname.com> 2012-03-24 17:52:11 PDT ---
DMD 2.058, Win32
----------
import std.stdio;

class Set(Element) {
    void show(Element e) {
        writefln("%s", e);
    }
}

void main() {
    Set!(const(Object)) set2;
}
----------
C:\Users\Stewart\Documents\Programming\D\Tests\bugs>dmd hashset1.d
d:\dmd2\windows\bin\..\..\src\phobos\std\format.d(1858): Error: template
instance formatObject!(LockingTextWriter,const(Object),char)
formatObject!(LockingTextWriter,const(Object),char) does not match template
declaration formatObject(Writer,T,Char) if (hasToString!(T,Char))
----------

main instantiates Set
Set instantiates writefln
writefln instantiates File.writefln
File.writefln instantiates formatGeneric
formatGeneric instantiates formatValue
formatValue tries to instantiates formatObject but fails

Despite this chain of template instantiations, no backtrace is printed. 
Consequently, it took me ages to find what in my code was triggering it in
order to produce this reduced testcase.

Fixing issue 1824 will invalidate this testcase, but won't fix the underyling
compiler bug, which could potentially bite in other ways.

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