Debian Codegraph @

gcc/testsuite/g++.dg/warn/Wshadow-19.C

raw
1 // { dg-do compile }
2 // { dg-options "-Wshadow" }
3
4 void
5 foo (int x)
6 {
7 int y = 1;
8 {
9 extern int x; // { dg-warning "declaration of 'int x' shadows a parameter" }
10 extern int y; // { dg-warning "declaration of 'y' shadows a previous local" }
11 }
12 #if __cplusplus >= 201102L
13 auto fn = [x] () { extern int x; return 0; }; // { dg-warning "declaration of 'x' shadows a lambda capture" "" { target c++11 } }
14 #endif
15 }
16
17 int z;
18
19 struct S
20 {
21 int x;
22 void foo ()
23 {
24 extern int x; // { dg-warning "declaration of 'x' shadows a member of 'S'" }
25 extern int z;
26 }
27 };