* parser.c (cp_parser_lambda_introducer): Reject `&this'. Use cp_lexer_nth_token_is instead of cp_lexer_peek_nth_token. * g++.dg/cpp0x/lambda/lambda-this21.C: New test. From-SVN: r272223
11 lines
307 B
C
11 lines
307 B
C
// PR c++/66999 - 'this' captured by reference.
|
|
// { dg-do compile { target c++11 } }
|
|
|
|
struct X {
|
|
void bar (int n)
|
|
{
|
|
auto l1 = [&this] { }; // { dg-error ".this. cannot be captured by reference" }
|
|
auto l2 = [=, &this] { }; // { dg-error ".this. cannot be captured by reference" }
|
|
}
|
|
};
|