1 // Test the declaration of nested lambda function shadows
2 // a parameter or previous local.
3 // { dg-do compile { target c++11 } }
4 // { dg-options "-Wshadow" }
7 int f1(int x) // { dg-message "shadowed declaration" }
10 int m = 0; // { dg-message "shadowed declaration" }
11 [&t] (int x) { // { dg-warning "shadows a parameter" }
12 int m = 1; // { dg-warning "shadows a previous local" }
18 void f2(struct S i, int j) {
21 void g(struct S i) { // { dg-message "shadowed declaration" }
22 struct S x; // { dg-warning "shadows a member of" }
23 struct S y; // { dg-message "shadowed declaration" }
25 [&t](struct S i){ // { dg-warning "shadows a parameter" }
26 int j = 1; // { dg-bogus "shadows" }
27 struct S y; // { dg-warning "shadows a previous local" }
36 int j = i; // { dg-message "shadowed declaration" }
37 int i; // { dg-warning "shadows a lambda capture" }
45 int j = i; // { dg-message "shadowed declaration" }
46 int i; // { dg-warning "shadows a " }
51 template void f4<int>(int);