summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/redecl-2.c
blob: fa0d5e447858dab51abe6dbc15913a4aee08243a (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* Test for multiple declarations of an identifier at same block
   scope: only valid case is all extern.  */
/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
/* { dg-do compile } */
/* { dg-options "" } */

void
fa0 (void)
{
  int a0; /* { dg-message "note: previous declaration" } */
  int a0; /* { dg-error "redeclaration" } */
}

void
fa1 (void)
{
  int a1; /* { dg-message "note: previous declaration" } */
  static int a1; /* { dg-error "redeclaration" } */
}

void
fa2 (void)
{
  int a2; /* { dg-message "note: previous declaration" } */
  extern int a2; /* { dg-error "follows declaration with no linkage" } */
}

void
fa3 (void)
{
  static int a3; /* { dg-message "note: previous declaration" } */
  int a3; /* { dg-error "redeclaration" } */
}

void
fa4 (void)
{
  static int a4; /* { dg-message "note: previous declaration" } */
  static int a4; /* { dg-error "redeclaration" } */
}

void
fa5 (void)
{
  static int a5; /* { dg-message "note: previous declaration" } */
  extern int a5; /* { dg-error "follows declaration with no linkage" } */
}

void
fa6 (void)
{
  extern int a6; /* { dg-message "note: previous declaration" } */
  int a6; /* { dg-error "follows extern declaration" } */
}

void
fa7 (void)
{
  extern int a7; /* { dg-message "note: previous declaration" } */
  static int a7; /* { dg-error "follows extern declaration" } */
}

void
fa8 (void)
{
  extern int a8;
  extern int a8;
}