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 8 "previous declaration was here" message, leaving you with no clue 9 where the previous declaration came from. */ 10 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" } */ 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" } */ 23