Re: copying const

2015-06-24 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, 24 June 2015 at 19:45:12 UTC, Adam D. Ruppe wrote: On Wednesday, 24 June 2015 at 19:41:54 UTC, Freddy wrote: I was surprised when this happened, is it a bug or a feature? Feature, overwriting const or immutable data would violate the promise that it never changes. Saving a struc

Re: copying const

2015-06-24 Thread Adam D. Ruppe via Digitalmars-d
On Wednesday, 24 June 2015 at 19:41:54 UTC, Freddy wrote: I was surprised when this happened, is it a bug or a feature? Feature, overwriting const or immutable data would violate the promise that it never changes. Saving a struct over another struct is just another way of overwriting the data

copying const

2015-06-24 Thread Freddy via Digitalmars-d
I was surprised when this happened, is it a bug or a feature? --- struct A { const int var; } int test() { auto b = A(5); auto c = A(7); pragma(msg, typeof(b)); //A pragma(msg, typeof(c)); //A auto d = b; //compiles b = c; //doesn't compile } --- $ rdmd -main -unittes