1 // RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-config suppress-c++-stdlib=false -verify %s
2 // RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-config suppress-c++-stdlib=true -DSUPPRESSED=1 -verify %s
3 
4 #ifdef SUPPRESSED
5 // expected-no-diagnostics
6 #endif
7 
8 #include "../Inputs/system-header-simulator-cxx.h"
9 
10 void clang_analyzer_eval(bool);
11 
12 class C {
13   // The virtual function is to make C not trivially copy assignable so that we call the
14   // variant of std::copy() that does not defer to memmove().
15   virtual int f();
16 };
17 
testCopyNull(C * I,C * E)18 void testCopyNull(C *I, C *E) {
19   std::copy(I, E, (C *)0);
20 #ifndef SUPPRESSED
21   // expected-warning@../Inputs/system-header-simulator-cxx.h:166 {{Called C++ object pointer is null}}
22 #endif
23 }
24