summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/redecl-2.c
blob: b1b7dc929debd49b057dd9d3ea7be437bf768c32 (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-error "previous declaration" } */
  int a0; /* { dg-error "redeclaration" } */
}

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

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

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

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

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

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

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

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