summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this.C
blob: 7a27cf44a6822020e46d9fd2688927959eb74e02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Test that implicit 'this' capture works, but that it's still an rvalue.
// { dg-do compile { target c++11 } }

struct A
{
  int i;
  void f()
  {
    [=] { i = 0; };		// { dg-warning "implicit capture" "" { target c++2a } }
    [&] { i = 0; };
    [=] { this = 0; };		// { dg-error "lvalue" }
// { dg-warning "implicit capture" "" { target c++2a } .-1 }
  }
};