| 1 |
/* Test for multiple declarations of an identifier at same block |
| 2 |
scope: only valid case is all extern. */ |
| 3 |
/* Origin: Joseph Myers <[email protected]> */ |
| 4 |
/* { dg-do compile } */ |
| 5 |
/* { dg-options "" } */ |
| 6 |
|
| 7 |
void |
| 8 |
fa0 (void) |
| 9 |
{ |
| 10 |
int a0; /* { dg-message "note: previous declaration" } */ |
| 11 |
int a0; /* { dg-error "redeclaration" } */ |
| 12 |
} |
| 13 |
|
| 14 |
void |
| 15 |
fa1 (void) |
| 16 |
{ |
| 17 |
int a1; /* { dg-message "note: previous declaration" } */ |
| 18 |
static int a1; /* { dg-error "redeclaration" } */ |
| 19 |
} |
| 20 |
|
| 21 |
void |
| 22 |
fa2 (void) |
| 23 |
{ |
| 24 |
int a2; /* { dg-message "note: previous declaration" } */ |
| 25 |
extern int a2; /* { dg-error "follows declaration with no linkage" } */ |
| 26 |
} |
| 27 |
|
| 28 |
void |
| 29 |
fa3 (void) |
| 30 |
{ |
| 31 |
static int a3; /* { dg-message "note: previous declaration" } */ |
| 32 |
int a3; /* { dg-error "redeclaration" } */ |
| 33 |
} |
| 34 |
|
| 35 |
void |
| 36 |
fa4 (void) |
| 37 |
{ |
| 38 |
static int a4; /* { dg-message "note: previous declaration" } */ |
| 39 |
static int a4; /* { dg-error "redeclaration" } */ |
| 40 |
} |
| 41 |
|
| 42 |
void |
| 43 |
fa5 (void) |
| 44 |
{ |
| 45 |
static int a5; /* { dg-message "note: previous declaration" } */ |
| 46 |
extern int a5; /* { dg-error "follows declaration with no linkage" } */ |
| 47 |
} |
| 48 |
|
| 49 |
void |
| 50 |
fa6 (void) |
| 51 |
{ |
| 52 |
extern int a6; /* { dg-message "note: previous declaration" } */ |
| 53 |
int a6; /* { dg-error "follows extern declaration" } */ |
| 54 |
} |
| 55 |
|
| 56 |
void |
| 57 |
fa7 (void) |
| 58 |
{ |
| 59 |
extern int a7; /* { dg-message "note: previous declaration" } */ |
| 60 |
static int a7; /* { dg-error "follows extern declaration" } */ |
| 61 |
} |
| 62 |
|
| 63 |
void |
| 64 |
fa8 (void) |
| 65 |
{ |
| 66 |
extern int a8; |
| 67 |
extern int a8; |
| 68 |
} |