Consider the following code:
struct S
{
int x;
void f()
{
auto l = [&](){ x = 42; }; //this is implicitly captured here
}
};
§5.1.2/14 states:
An entity is captured by copy if it is implicitly captured and the capture-default is = or if it is explicitly captured with a capture that does not include an &.
Hence I conclude, that this is not captured by copy. But then by §5.1.2/15:
An entity is captured by reference if it is implicitly or explicitly captured but not captured by copy. It is unspecified whether additional unnamed non-static data members are declared in the closure type for entities captured by reference.
this is captured by reference. But now §5.1.2/17 states:
[...] If
thisis captured, each odr-use ofthisis transformed into an access to the corresponding unnamed data member of the closure type, [...]
As far as I understand, this implies that there must be an unnamed data member in the closure type corresponding to the this pointer. But since this is captured by reference the standard doesn't demand that such a member exists. What do I get wrong?