Files
gcc-reflection/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic18.C
Ville Voutilainen 63b48839b8 re PR c++/79133 (lambda capture shadowing parameter & decltype confusion)
PR c++/79133

gcc/cp/

PR c++/79133
* name-lookup.c (check_local_shadow): Reject captures and parameters
with the same name.

testsuite/

PR c++/79133
* g++.dg/cpp0x/lambda/lambda-shadow3.C: New.
* g++.dg/cpp1y/lambda-generic-variadic18.C: Likewise.

From-SVN: r263357
2018-08-07 16:46:16 +03:00

12 lines
460 B
C

// { dg-do compile { target c++14 } }
int main() {
int x = 42;
auto lambda2 = [x=x](int x) {}; // { dg-error "previously declared as a capture" }
auto lambda3 = [x](auto... x) {}; // { dg-error "previously declared as a capture" }
auto lambda4 = [](auto... x) {
auto lambda5 = [x...](auto... x) {}; // { dg-error "previously declared as a capture" }
auto lambda6 = [x...](int x) {}; // { dg-error "previously declared as a capture" }
};
}