| 1 |
/* This test assumes -fbuiltin and not -fansi to get "index" and "memchr" builtin DECLs. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "" } */ |
| 4 |
|
| 5 |
/* The bug this is testing is that if a new decl conflicts with an |
| 6 |
explicit decl, you don't get the "changes type of builtin" message, |
| 7 |
but if there was *also* a builtin, you *also* don't get the "previous |
| 8 |
declaration" message, leaving you with no clue where the previous |
| 9 |
declaration came from. */ |
| 10 |
|
| 11 |
extern char foo(int,int); /* { dg-message "previous declaration of 'foo'" "note" } */ |
| 12 |
extern char *index(const char *,int); /* { dg-message "previous declaration of 'index'" "note" } */ |
| 13 |
|
| 14 |
/* This changes the type of "index", which is both a builtin and an |
| 15 |
explicit decl. */ |
| 16 |
int index; /* { dg-error "redeclared as different kind of symbol" } */ |
| 17 |
|
| 18 |
/* This changes the type of "memchr", which is only a builtin. */ |
| 19 |
int memchr; /* { dg-warning "built-in function 'memchr' declared as non-function" } */ |
| 20 |
|
| 21 |
/* This changes the type of "foo", which is only an explicit decl. */ |
| 22 |
int foo; /* { dg-error "redeclared as different kind of symbol" } */ |