| Douglas Gregor | 3e41d60 | 2009-02-13 23:20:09 +0000 | [diff] [blame^] | 1 | // RUN: clang -fsyntax-only -verify %s | 
|  | 2 | void f() { | 
|  | 3 | int *ptr = malloc(sizeof(int) * 10); // expected-warning{{implicitly declaring C library function 'malloc' with type}} \ | 
|  | 4 | // expected-note{{please include the header <stdlib.h> or explicitly provide a declaration for 'malloc'}} \ | 
|  | 5 | // expected-note{{'malloc' was implicitly declared here with type 'void *}} | 
|  | 6 | } | 
|  | 7 |  | 
|  | 8 | void *alloca(__SIZE_TYPE__); // redeclaration okay | 
|  | 9 |  | 
|  | 10 | int *calloc(__SIZE_TYPE__, __SIZE_TYPE__); // expected-error{{conflicting types for 'calloc'}} \ | 
|  | 11 | // expected-note{{'calloc' was implicitly declared here with type 'void *}} | 
|  | 12 |  | 
|  | 13 |  | 
|  | 14 | void g(int malloc) { // okay: these aren't functions | 
|  | 15 | int calloc = 1; | 
|  | 16 | } | 
|  | 17 |  | 
|  | 18 | void h() { | 
|  | 19 | int malloc(int); // expected-error{{conflicting types for 'malloc'}} | 
|  | 20 | int strcpy(int); // expected-error{{conflicting types for 'strcpy'}} \ | 
|  | 21 | // expected-note{{'strcpy' was implicitly declared here with type 'char *(char *, char const *)'}} | 
|  | 22 | } |