Re: A problem with mutable toString

2012-04-09 Thread Kenji Hara
On Monday, 9 April 2012 at 00:25:57 UTC, bearophile wrote: Currently this code compiles and runs with no errors: class Foo { override string toString() const { return "Foo"; } } void main() { import std.stdio; const Foo[] foos = [new Foo]; writeln(foos); }

Re: A problem with mutable toString

2012-04-09 Thread bearophile
Maybe related to this? http://d.puremagic.com/issues/show_bug.cgi?id=7864

Re: A problem with mutable toString

2012-04-08 Thread H. S. Teoh
On Mon, Apr 09, 2012 at 02:25:56AM +0200, bearophile wrote: [...] > While this gives errors: > > class Foo { > override string toString() /*const*/ { > return "Foo"; > } > } > void main() { > import std.stdio; > const Foo[] foos = [new Foo]; > writeln(foos);

A problem with mutable toString

2012-04-08 Thread bearophile
Currently this code compiles and runs with no errors: class Foo { override string toString() const { return "Foo"; } } void main() { import std.stdio; const Foo[] foos = [new Foo]; writeln(foos); } Output, DMD 2.059beta2: [Foo] While this gives errors