1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,cplusplus.NewDeleteLeaks -verify %s
25 new int; // expected-warning@+1 {{Potential memory leak}}
26 new A0
; // expected-warning@+1 {{Potential memory leak}}
27 new A1(0); // expected-warning@+1 {{Potential memory leak}}
28 new A2
; // expected-warning@+1 {{Potential memory leak}}
32 new A2(s
); // expected-warning@+1 {{Potential memory leak}}
33 new A2(&(s
.i
)); // expected-warning@+1 {{Potential memory leak}}
34 new A2(ps
); // no warning
35 new A2(*ps
, 1); // no warning
36 new A2(1, &ps
); // no warning
38 // Tests to ensure that leaks are reported for consumed news no matter what the arguments are.
39 A2
*a2p1
= new A2
; // expected-warning@+1 {{Potential leak of memory}}
40 A2
*a2p2
= new A2(ps
); // expected-warning@+1 {{Potential leak of memory}}
41 A2
*a2p3
= new A2(*ps
, 1); // expected-warning@+1 {{Potential leak of memory}}
42 A2
*a2p4
= new A2(1, &ps
); // expected-warning@+1 {{Potential leak of memory}}