[Issue 2899] New: Object.toString is not declared const

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Apr 25 12:32:59 PDT 2009


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

           Summary: Object.toString is not declared const
           Product: D
           Version: 2.029
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: someanon at yahoo.com


I don't have a code snippets, but in dmd-v2.029/src/phobos/std/format.d:2054

    else static if (is(const(D) : const Object)) {
        // @@@BUG 2367@@@
        //if (obj is null) w.write("null");
        if (obj is null) w.put("null"[]);
        else w.put(obj.toString);  // 2054
    }

dmd/linux/bin/../bin/../../src/phobos/std/format.d(2054): Error: obj.toString
can only be called on a mutable object, not const(...)

This because Object.toString is not declared const.

So how to fix this?


-- 



More information about the Digitalmars-d-bugs mailing list