Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/lambda/lambda-capture-redundancy.C

raw
1 // FDIS 5.1.2/8
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-pedantic-errors" }
4
5 struct S2 { void f(int i); };
6 void S2::f(int i) {
7 [&, i]{ }; // OK
8 [&, &i]{ }; // { dg-error "" } i preceded by & when & is the default
9 [=, i]{ }; // { dg-error "" } i not preceded by & when = is the default
10 [=, this]{ }; // { dg-error "" "" { target c++17_down } } this when = is the default
11 [i, i]{ }; // { dg-error "" } i repeated
12 [this, this]{ }; // { dg-error "" } i repeated
13 }