On Feb 10, 2012, at 5:56 AM, David Blaikie wrote:

> On Fri, Feb 10, 2012 at 1:37 AM, Douglas Gregor <[email protected]> wrote:
>> Author: dgregor
>> Date: Fri Feb 10 03:37:05 2012
>> New Revision: 150239
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=150239&view=rev
>> Log:
>> Add a lambda example from the working draft.
>> 
>> Modified:
>>    cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp
>> 
>> Modified: cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp?rev=150239&r1=150238&r2=150239&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp (original)
>> +++ cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp Fri Feb 10 
>> 03:37:05 2012
>> @@ -14,3 +14,12 @@
>>     (void)[&, this] () {};
>>   }
>>  };
>> +
>> +struct S2 { void f(int i); };
>> +
>> +void S2::f(int i) {
>> +  (void)[&, i]{ };
>> +  (void)[&, &i]{ }; // expected-error{{'&' cannot precede a capture when 
>> the capture default is '&'}}
>> +  (void)[=, this]{ }; // expected-error{{'this' cannot appear in a capture 
>> list when the capture default is '='}}
> 
> Diagnostic text - should that be 'this' can only be explicitly
> captured by reference when the default capture is '='? (the way it
> reads now it sounds like 'this' cannot be captured at all if the
> default capture is '=' - but I know it can get a bit verbose/difficult
> to read if one is too explicit/pedantic)


Very nice catch! It looks like we had misinterpreted the wording here, because 
we were also rejecting implicit capture of 'this' with an '=' capture default.

Fixed in r150256, thanks!

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

Reply via email to