www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11605] New: Cannot print const classes

https://d.puremagic.com/issues/show_bug.cgi?id=11605

           Summary: Cannot print const classes
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: monarchdodra gmail.com



Not sure if druntime or phobos problem.

//----
import std.stdio;

class Foo{}

void main()
{
  immutable(Foo) a;
  writeln(a);
}
//----
src\phobos\std\format.d(2619): Error: template instance
formatObject!(LockingTextWriter, immutable(Foo), char) does not match template
declaration formatObject(Writer, T, Char)(ref Writer w, ref T val, ref
FormatSpec!Char f) if (hasToString!(T, Char))
src\phobos\std\format.d(3056): Error: template instance
std.format.formatValue!(LockingTextWriter, immutable(Foo), char) error
instantiating
src\phobos\std\format.d(427):        instantiated from here:
formatGeneric!(LockingTextWriter, immutable(Foo), char)
//----

The "root" problem seems related to
"https://d.puremagic.com/issues/show_bug.cgi?id=7879" : "toString" is not
const.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 26 2013