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

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?


Reply via email to