aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-capture-redundancy.C
blob: 49fbdf32045c583b21f88bc7aa47b34b4d4692d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// FDIS 5.1.2/8
// { dg-do compile { target c++11 } }
// { dg-options "-pedantic-errors" }

struct S2 { void f(int i); };
void S2::f(int i) {
  [&, i]{ };       // OK
  [&, &i]{ };	   // { dg-error "" } i preceded by & when & is the default
  [=, i]{ };       // { dg-error "" } i not preceded by & when = is the default
  [=, this]{ };	   // { dg-error "" } this when = is the default
  [i, i]{ };	   // { dg-error "" } i repeated
  [this, this]{ }; // { dg-error "" } i repeated
}