* c-decl.c (locate_old_decl): If a previous conflicting decl is
[official-gcc.git] / gcc / testsuite / gcc.dg / mismatch-decl-1.c
blobda4db0a57f0efcd081c0adce11474a9ea74ca937
1 /* This test assumes -fbuiltin and not -fansi to get "index" and "memchr" builtin DECLs. */
2 /* { dg-do compile } */
3 /* { dg-options "" } */
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
8 "previous declaration was here" message, leaving you with no clue
9 where the previous declaration came from. */
11 extern char foo(int,int); /* { dg-message "previous declaration of 'foo' was here" } */
12 extern char *index(const char *,int); /* { dg-message "previous declaration of 'index' was here" } */
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" } */
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" } */
21 /* This changes the type of "foo", which is only an explicit decl. */
22 int foo; /* { dg-error "redeclared as different kind of symbol" } */