1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.Malloc,unix.MismatchedDeallocator -std=c++11 -verify %s
2 // expected-no-diagnostics
4 typedef __typeof(sizeof(int)) size_t;
8 //--------------------------------------------------------------------
9 // Check that unix.Malloc + unix.MismatchedDeallocator does not enable
10 // warnings produced by the alpha.cplusplus.NewDelete checker.
11 //--------------------------------------------------------------------
12 void testNewDeleteNoWarn() {
14 delete &i
; // no-warning
17 delete ++p1
; // no-warning
21 delete p2
; // no-warning
23 int *p3
= new int; // no-warning
27 int j
= *p4
; // no-warning
30 void testUseZeroAllocNoWarn() {
31 int *p1
= (int *)operator new(0);
32 *p1
= 1; // no-warning
34 int *p2
= (int *)operator new[](0);
35 p2
[0] = 1; // no-warning
38 p3
[0] = 1; // no-warning