Debian Codegraph @

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

raw
1 // PR c++/91868 - improve -Wshadow location.
2 // { dg-options "-Wshadow" }
3
4 int global; // { dg-message "shadowed declaration" }
5
6 struct S
7 {
8 static int bar; // { dg-message "shadowed declaration" }
9 S (int i) { int bar // { dg-warning "19:declaration of .bar. shadows a member" }
10 (1);
11 int global // { dg-warning "9:declaration of .global. shadows a global declaration" }
12 (42);
13 }
14 };
15
16 void
17 foo ()
18 {
19 int xx; // { dg-message "shadowed declaration" }
20 {
21 S xx // { dg-warning "7:declaration of .xx. shadows a previous local" }
22 (42);
23 }
24 }