[PATCH] D29908: Disallow returning a __block variable via a move
Akira Hatanaka via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 14 13:57:10 PST 2017
ahatanak added a comment.
In https://reviews.llvm.org/D29908#676788, @rjmccall wrote:
> Oh, I see. Just to clarify: it doesn't matter that the object "ret" used to point to has been destructed, what matters is that "ret" now holds a null reference because it's been moved out of.
Yes, that's right.
> I retract my comment; I agree there's a bug here. We should not implicitly move out of __block variables during a return because we cannot assume that the variable will no longer be used. Please update the comment to correctly identify this as the reasoning; it has nothing to do with whether __block variables technically *can* support NRVO.
OK, thanks. I was wondering whether there is something we should or can do in IRGen to make it work, but it looks like we have to just disable moving out of block variables.
I'll commit this patch later today.
https://reviews.llvm.org/D29908
More information about the cfe-commits
mailing list