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



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to