shared and idup

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Aug 19 12:00:48 PDT 2014


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 other non-reference elements) and cast to immutable, would 
> I be in danger of undefined behavior?

Try upgrading you compiler to the just released 2.067, it works 
for me with that version.


More information about the Digitalmars-d-learn mailing list