aliasing expressions and identifiers

Marc Schütz via Digitalmars-d digitalmars-d at puremagic.com
Thu May 26 01:13:04 PDT 2016


On Tuesday, 24 May 2016 at 13:48:41 UTC, Nick Treleaven wrote:
> What about:
>
> @safe unittest
> {
> 	RCArray!int arr;
> 	ref r = arr[0];
> 	arr.destroy; // refcount drops to zero, arr.impl memory freed
> 	r++; // writes to unallocated memory
> }

You're calling `destroy` explicitly, what else would you expect 
to happen?


More information about the Digitalmars-d mailing list