| 1 | // RUN: %clang_analyze_cc1 -analyzer-checker=core,cplusplus.NewDelete,cplusplus.NewDeleteLeaks,unix.Malloc -std=c++11 -fblocks -verify %s |
| 2 | // expected-no-diagnostics |
| 3 | |
| 4 | namespace std { |
| 5 | typedef __typeof__(sizeof(int)) size_t; |
| 6 | } |
| 7 | |
| 8 | struct X {}; |
| 9 | |
| 10 | void *operator new(std::size_t, X, ...); |
| 11 | void *operator new[](std::size_t, X, ...); |
| 12 | |
| 13 | void testGlobalCustomVariadicNew() { |
| 14 | X x; |
| 15 | |
| 16 | void *p1 = operator new(0, x); // no warn |
| 17 | |
| 18 | void *p2 = operator new[](0, x); // no warn |
| 19 | |
| 20 | int *p3 = new (x) int; // no warn |
| 21 | |
| 22 | int *p4 = new (x) int[0]; // no warn |
| 23 | } |
| 24 | |