1// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.Malloc,cplusplus.NewDelete -std=c++11 -verify %s
2// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.Malloc,cplusplus.NewDelete,alpha.cplusplus.NewDeleteLeaks -std=c++11 -verify %s
3
4typedef __typeof(sizeof(int)) size_t;
5void *malloc(size_t);
6void free(void *);
7
8//-------------------------------------------------------------------
9// Check that unix.Malloc + cplusplus.NewDelete does not enable
10// warnings produced by unix.MismatchedDeallocator.
11//-------------------------------------------------------------------
12void testMismatchedDeallocator() {
13  int *p = (int *)malloc(sizeof(int));
14  delete p;
15} // expected-warning{{Potential leak of memory pointed to by 'p'}}
16