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