shared and idup

2014-08-19 Thread Low Functioning via Digitalmars-d-learn
shared int[] foo; auto bar() { foo ~= 42; return foo.idup; } Error: cannot implicitly convert element type shared(int) to immutable in foo.idup Is this not correct? If I instead dup'd an array of ints (or some other non-reference elements) and cast to immutable, would I be in

Re: shared and idup

2014-08-19 Thread via Digitalmars-d-learn
On Tuesday, 19 August 2014 at 17:56:31 UTC, Low Functioning wrote: shared int[] foo; auto bar() { foo ~= 42; return foo.idup; } Error: cannot implicitly convert element type shared(int) to immutable in foo.idup Is this not correct? If I instead dup'd an array of ints (or some

Re: shared and idup

2014-08-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, 19 August 2014 at 19:00:49 UTC, Marc Schütz wrote: On Tuesday, 19 August 2014 at 17:56:31 UTC, Low Functioning wrote: shared int[] foo; auto bar() { foo ~= 42; return foo.idup; } Error: cannot implicitly convert element type shared(int) to immutable in foo.idup Is