aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/warn/Wshadow-local-1.C
blob: 24a5bc22347f797d3439d88e887dd5c3bc92bc5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* { dg-do compile } */
/* { dg-options -Wshadow-local } */

struct status
{
  int member;
  void foo2 ();

  inline static int foo3 (int member)
  {
    return member;
  }
};

int decl1;                      // { dg-bogus "shadowed declaration" }
int decl2;                      // { dg-bogus "shadowed declaration" }
void foo (struct status &status,
	  double decl1)		// { dg-bogus "shadows a global" }
{
}

void foo1 (int d)
{
  double d;			// { dg-error "shadows a parameter" }
}

void status::foo2 ()
{
  int member;			// { dg-bogus "shadows a member" }
  int decl2;			// { dg-bogus "shadows a global" }
  int local;			// { dg-warning "shadowed declaration" }
  {
    int local;			// { dg-warning "shadows a previous local" }
  }
}