blob: 523785a70415b154c26e7aabe00ee3fec8e241f3 [file] [log] [blame]
Dominic Chen184c6242017-03-03 18:02:02 +00001// RUN: %clang_analyze_cc1 -analyzer-checker=core,cplusplus.NewDelete,cplusplus.NewDeleteLeaks,unix.Malloc -std=c++11 -fblocks -verify %s
Anton Yartsev8b662702013-03-28 16:10:38 +00002// expected-no-diagnostics
3
4namespace std {
5 typedef __typeof__(sizeof(int)) size_t;
6}
7
Richard Smithbdd14642014-02-04 01:14:30 +00008struct X {};
9
10void *operator new(std::size_t, X, ...);
11void *operator new[](std::size_t, X, ...);
Anton Yartsev8b662702013-03-28 16:10:38 +000012
13void testGlobalCustomVariadicNew() {
Richard Smithbdd14642014-02-04 01:14:30 +000014 X x;
Anton Yartsev8b662702013-03-28 16:10:38 +000015
Richard Smithbdd14642014-02-04 01:14:30 +000016 void *p1 = operator new(0, x); // no warn
Anton Yartsev8b662702013-03-28 16:10:38 +000017
Richard Smithbdd14642014-02-04 01:14:30 +000018 void *p2 = operator new[](0, x); // no warn
Anton Yartsev8b662702013-03-28 16:10:38 +000019
Richard Smithbdd14642014-02-04 01:14:30 +000020 int *p3 = new (x) int; // no warn
21
22 int *p4 = new (x) int[0]; // no warn
Anton Yartsev8b662702013-03-28 16:10:38 +000023}