aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/Wshadow-1.c
blob: 40073f337b49c01af5133b21a71f90c2cea53aa6 (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
/* Copyright (C) 2001 Free Software Foundation, Inc.  */

/* { dg-do compile } */
/* { dg-options "-Wshadow -pedantic-errors" } */

/* Source: Neil Booth, 5 Dec 2001.  */

int decl1;			/* { dg-warning "shadowed declaration" } */
void foo (double decl1)		/* { dg-warning "shadows a global decl" } */
{				
}

void foo1 (int d)		/* { dg-message "note: previous definition" } */
{
  double d;	 /* { dg-bogus "warning" "warning in place of error" } */
  /* { dg-error "redeclared as different" "" { target *-*-* } 15 } */
}

void foo2 (int d)		/* { dg-warning "shadowed declaration" } */
{
  {
    double d;			/* { dg-warning "shadows a parameter" } */
  }
}

void foo3 ()
{
  int local;			/* { dg-warning "shadowed declaration" } */
  {
    int local;			/* { dg-warning "shadows a previous local" } */
  }
}