[swift-dev] isUniquelyReferenced issues

Joe Groff jgroff at apple.com
Fri Apr 1 10:43:21 CDT 2016

> On Mar 31, 2016, at 11:49 PM, Patrick Pijnappel <patrickpijnappel at gmail.com> wrote:
> The modified version doesn't seem to change any of the results (on -O or -Onone). Note that the problem is that it's not uniquely referenced inside bar where it actually should be – that would mean that ownership is currently not directly transferred right?

You're right, I'm sorry, I misread your original comment. If the ARC optimizer didn't transfer ownership, then it is correct for `isUniquelyReferenced` to be false inside `bar`, since the `foo` inside of `test` and the `foo` parameter to `bar` are semantically independent values. If this weren't the case, then `bar` could modify a COW value type and have its changes be seen back in `test`'s copy.


More information about the swift-dev mailing list