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?
Comment #1 by someanon — 2009-04-26T13:36:41Z
I changed line 2054 to:
else w.put((cast(Object)obj).toString);
it seems to be working.
Comment #2 by dfj1esp02 — 2009-05-27T06:24:24Z
*** This issue has been marked as a duplicate of issue 1824 ***