The reason [&this] does not work because it is a syntax error. Each parameter, separated by commas, in lambda-introducer is equal to capture :
capture: identifier & identifier this
You can see that &this not allowed syntactically. The reason this is unacceptable is because you will never want to grab this by reference, as this is a small const pointer. You would only want to pass it by value - therefore, the language simply does not support capturing this by reference.
To capture this explicitly, you can use [this] as a lambda-introducer .
The first capture can be capture-default , which:
capture-default: & =
This means that you automatically capture everything that I use by reference ( & ) or by value ( = ) respectively - however, this treatment is special - in both cases it is fixed by value for the above reasons earlier (even with the default capture & , which usually means capturing by reference).
5.1.2.7/8:
To search for the name (3.4), determining the type and value of this (9.3.2) and converting id expressions related to non-stationary members of the class to expressions for accessing the members of the class using (*this) (9.3.1), the compound operator [ OF LAMBDA] is considered in the context of a lambda expression.
So, the lambda acts as if it were part of an incoming member function using member names (for example, using the name x in your example), so it will generate "implicit usages" of this , like a member function does.
If the lambda capture includes a default capture, i.e. & , the identifiers in the lambda capture should not be preceded by & . If a lambda capture includes a default capture value of = , the lambda capture must not contain this , and each identifier it contains is preceded by & . The identifier or this should not be displayed more than once in a lambda capture.
So you can use [this] , [&] , [=] or [&,this] as a lambda-introducer to grab the this pointer by value.
However, [&this] and [=, this] poorly formed. In the latter case, gcc gratefully warns for [=,this] that explicit by-copy capture of 'this' redundant with by-copy capture default , and not errors.