================ @@ -63,6 +64,42 @@ void testGlobalNoThrowPlacementExprNewBeforeOverload() { int *p = new(std::nothrow) int; } // leak-warning{{Potential leak of memory pointed to by 'p'}} +//----- Standard pointer placement operators +void testGlobalPointerPlacementNew() { + int i; + void *p1 = operator new(0, &i); // no warn + + void *p2 = operator new[](0, &i); // no warn + + int *p3 = new(&i) int; // no warn + + int *p4 = new(&i) int[0]; // no warn ---------------- balazs-benics-sonarsource wrote:
```suggestion void *p1 = operator new(0, &i); // no leak: placement new never allocates void *p2 = operator new[](0, &i); // no leak int *p3 = new(&i) int; // no leak int *p4 = new(&i) int[0]; // no leak ``` https://github.com/llvm/llvm-project/pull/144341 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits