2017-03-03 07:05:45 +08:00
|
|
|
// RUN: %clang_analyze_cc1 -analyzer-checker=core,cplusplus.NewDelete,cplusplus.NewDeleteLeaks,unix.Malloc -std=c++11 -fblocks -verify %s
|
2013-03-29 00:10:38 +08:00
|
|
|
// expected-no-diagnostics
|
|
|
|
|
|
|
|
namespace std {
|
|
|
|
typedef __typeof__(sizeof(int)) size_t;
|
|
|
|
}
|
|
|
|
|
2014-02-04 09:14:30 +08:00
|
|
|
struct X {};
|
|
|
|
|
|
|
|
void *operator new(std::size_t, X, ...);
|
|
|
|
void *operator new[](std::size_t, X, ...);
|
2013-03-29 00:10:38 +08:00
|
|
|
|
|
|
|
void testGlobalCustomVariadicNew() {
|
2014-02-04 09:14:30 +08:00
|
|
|
X x;
|
|
|
|
|
|
|
|
void *p1 = operator new(0, x); // no warn
|
2013-03-29 00:10:38 +08:00
|
|
|
|
2014-02-04 09:14:30 +08:00
|
|
|
void *p2 = operator new[](0, x); // no warn
|
2013-03-29 00:10:38 +08:00
|
|
|
|
2014-02-04 09:14:30 +08:00
|
|
|
int *p3 = new (x) int; // no warn
|
2013-03-29 00:10:38 +08:00
|
|
|
|
2014-02-04 09:14:30 +08:00
|
|
|
int *p4 = new (x) int[0]; // no warn
|
2013-03-29 00:10:38 +08:00
|
|
|
}
|