On Nov 2, 2011, at 10:57 AM, jahanian wrote:

> 
> On Nov 2, 2011, at 10:19 AM, Douglas Gregor wrote:
> 
>> 
>> 
>>> Alternatively, we could just forbid the capturing of rvalue references. 
>>> Let the user make an explicit choice by either creating a local copy or 
>>> a local lvalue reference.
>> 
>> 
>> This might just be the best solution, since the only seems that is clear is 
>> that there are no clear semantics :)
>> 
>> Forcing users to perform the capture makes them choose between, e.g.,
>> 
>>      __block T captured_x = move(x);
> 
> Yes.
> 
>> 
>> or
>> 
>>      __block T &captured_x = x;
> 
> Wouldn't you be passing down reference to the temporary to the block here? 
> Or, does semantic of rvalue-reference requires a copy
> being made here?


Yes, this would be passing down a reference to the temporary. That may be what 
you want, if you know your block is only going to die before you leave the 
current stack frame.

        - Doug
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to