On Sunday, 26 April 2015 at 03:48:00 UTC, tcak wrote:
On Sunday, 26 April 2015 at 03:09:17 UTC, Meta wrote:
The following code spits out pages of error messages, and it's
driving me insane. I know that Object.toString only has a
mutable variant, so how am I supposed to use writeln,
toString, etc. with an inout, const, or immutable object?
void main(inout string[] args)
{
import std.stdio;
immutable(Object) o = new immutable Object();
//Compile error: template instance
//std.format.formatGeneric!(
// LockingTextWriter, immutable(Object),
// char)
//error instantiating
writeln(o);
}
writeln( cast(Object)o );
Tada!!
Also undefined behaviour, AFAIK.