blob: 3faef0b719f4bc678e7a3bbd60d1b53bf3bd4c1d [file] [log] [blame]
Douglas Gregor3e41d602009-02-13 23:20:09 +00001// RUN: clang -fsyntax-only -verify %s
2void 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
8void *alloca(__SIZE_TYPE__); // redeclaration okay
9
10int *calloc(__SIZE_TYPE__, __SIZE_TYPE__); // expected-error{{conflicting types for 'calloc'}} \
11 // expected-note{{'calloc' was implicitly declared here with type 'void *}}
12
13
14void g(int malloc) { // okay: these aren't functions
15 int calloc = 1;
16}
17
18void 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}