1 /* Copyright (C) 2001, 2002 Free Software Foundation, Inc.  */
2 
3 /* { dg-do compile } */
4 /* { dg-options -Wshadow } */
5 
6 /* Source: Neil Booth, 3 Nov 2001, and PR 16, 713.  -Wshadow was
7    giving a bunch of warnings we didn't want, and wasn't giving the
8    location of the shadowed variable.  */
9 
10 struct status			// { dg-bogus "shadowed declaration" }
11 {
12   int member;
13   void foo2 ();
14 
foo3status15   inline static int foo3 (int member) // { dg-bogus "shadows" }
16   {
17     return member;
18   }
19 };
20 
21 int decl1;			// { dg-message "shadowed declaration" }
22 int decl2;			// { dg-message "shadowed declaration" }
foo(struct status & status,double decl1)23 void foo (struct status &status,// { dg-bogus "shadows a global decl" }
24 	  double decl1)		// { dg-warning "shadows a global decl" }
25 {
26 }
27 
foo1(int d)28 void foo1 (int d)
29 {
30   double d;			// { dg-error "shadows a parameter" }
31 }
32 
foo2()33 void status::foo2 ()
34 {
35   int member;			// { dg-warning "shadows a member" }
36   int decl2;			// { dg-warning "shadows a global decl" }
37   int local;			// { dg-message "shadowed declaration" }
38   {
39     int local;			// { dg-warning "shadows a previous local" }
40   }
41 }
42