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 10struct status // { dg-bogus "shadowed declaration" } 11{ 12 int member; 13 void foo2 (); 14 15 inline static int foo3 (int member) // { dg-bogus "shadows" } 16 { 17 return member; 18 } 19}; 20 21int decl1; // { dg-warning "shadowed declaration" } 22int decl2; // { dg-warning "shadowed declaration" } 23void foo (struct status &status,// { dg-bogus "shadows a global decl" } 24 double decl1) 25{ // { dg-warning "shadows a global decl" } 26} 27 28void foo1 (int d) 29{ 30 double d; // { dg-error "shadows a parameter" } 31} 32 33void status::foo2 () 34{ 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 } 41} 42