1 // RUN: %clang_analyze_cc1 -std=c++11 %s \ 2 // RUN: -analyzer-checker=core \ 3 // RUN: -analyzer-checker=cplusplus.NewDelete \ 4 // RUN: -analyzer-checker=cplusplus.PlacementNew \ 5 // RUN: -analyzer-output=text -verify \ 6 // RUN: -triple x86_64-unknown-linux-gnu 7 8 // expected-no-diagnostics 9 10 #include "Inputs/system-header-simulator-cxx.h" 11 12 struct X { operator newX13 static void *operator new(std::size_t sz, void *b) { 14 return ::operator new(sz, b); 15 } 16 long l; 17 }; f()18void f() { 19 short buf; 20 X *p1 = new (&buf) X; 21 (void)p1; 22 } 23