1a5728872c7702ddd09537c95bc3cbd20e1f2fb09Daniel Dunbar// RUN: %clang_cc1 -fsyntax-only -verify %s
29add31798f621f843233dbff8bba103fca64447bDouglas Gregor
39add31798f621f843233dbff8bba103fca64447bDouglas Gregor// PR3592
49add31798f621f843233dbff8bba103fca64447bDouglas Gregorstatic void* malloc(int);
59add31798f621f843233dbff8bba103fca64447bDouglas Gregorstatic void* malloc(int size) {
69add31798f621f843233dbff8bba103fca64447bDouglas Gregor  return ((void*)0); /*do not use heap in this file*/
79add31798f621f843233dbff8bba103fca64447bDouglas Gregor}
8c2b6a8239326456753cd7d636656e420feaecb40Douglas Gregor
92fe9b7fb07dff15dd15dd8755a9a9e6de0fe46fcRichard Trieuvoid *calloc(int, int, int); // expected-warning{{incompatible redeclaration of library function 'calloc'}} \
109b76143b09a601dc3990b55934f02097f093a699Douglas Gregor// expected-note{{'calloc' is a builtin with type 'void *}}
11c2b6a8239326456753cd7d636656e420feaecb40Douglas Gregor
12c2b6a8239326456753cd7d636656e420feaecb40Douglas Gregorvoid f1(void) {
13374e156647e4250274eb66102839abf0ee9d7fe8Douglas Gregor  calloc(0, 0, 0);
14c2b6a8239326456753cd7d636656e420feaecb40Douglas Gregor}
156bec78d58b2fa73939c9cc16543c14433f004d5aDouglas Gregor
166bec78d58b2fa73939c9cc16543c14433f004d5aDouglas Gregorvoid f2() {
176bec78d58b2fa73939c9cc16543c14433f004d5aDouglas Gregor  int index = 1;
186bec78d58b2fa73939c9cc16543c14433f004d5aDouglas Gregor}
196bec78d58b2fa73939c9cc16543c14433f004d5aDouglas Gregor
206bec78d58b2fa73939c9cc16543c14433f004d5aDouglas Gregorstatic int index;
216bec78d58b2fa73939c9cc16543c14433f004d5aDouglas Gregor
226bec78d58b2fa73939c9cc16543c14433f004d5aDouglas Gregorint f3() {
236bec78d58b2fa73939c9cc16543c14433f004d5aDouglas Gregor  return index << 2;
246bec78d58b2fa73939c9cc16543c14433f004d5aDouglas Gregor}
256bec78d58b2fa73939c9cc16543c14433f004d5aDouglas Gregor
264fcfde4d5c8f25e40720972a5543d538a0dcb220Daniel Dunbartypedef int rindex;
27