2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.dg / warn / Wshadow-1.C
blob2ea076e1536184513b1bb22de719f309fd00d1b2
1 /* Copyright (C) 2001, 2002 Free Software Foundation, Inc.  */
3 /* { dg-do compile } */
4 /* { dg-options -Wshadow } */
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.  */
10 struct status                   // { dg-bogus "shadowed declaration" }
12   int member;
13   void foo2 ();
15   inline static int foo3 (int member) // { dg-bogus "shadows" }
16   {
17     return member;
18   }
21 int decl1;                      // { dg-warning "shadowed declaration" }
22 int decl2;                      // { dg-warning "shadowed declaration" }
23 void foo (struct status &status,// { dg-bogus "shadows a global decl" }
24           double decl1)
25 {                               // { dg-warning "shadows a global decl" }
28 void foo1 (int d)
30   double d;                     // { dg-error "shadows a parameter" }
33 void status::foo2 ()
35   int member;                   // { dg-warning "shadows a member" }
36   int decl2;                    // { dg-warning "shadows a global decl" }
37   int local;                    // { dg-warning "shadowed declaration" }
38   {
39     int local;                  // { dg-warning "shadows a previous local" }
40   }