1 // RUN: %clang_analyze_cc1 -std=c++14 \
2 // RUN: -analyzer-checker=core,debug.ExprInspection \
5 void clang_analyzer_eval(bool);
6 void clang_analyzer_warnIfReached();
8 typedef __typeof__(sizeof(int)) size_t;
10 void *operator new(size_t size
) throw() {
12 // expected-warning@-1 {{null returned from function that requires a non-null return value}}
14 void *operator new[](size_t size
) throw() {
16 // expected-warning@-1 {{null returned from function that requires a non-null return value}}
22 // FIXME: Constructor should not be called with null this, even if it was
23 // returned by operator new().
24 clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
30 S
*s
= new S
[10]; // no-crash
32 // no-warning: 'Dereference of null pointer' suppressed by ReturnVisitor.
36 void testInvalidationOnConstructionIntoNull() {
39 // FIXME: Should be FALSE - we should not invalidate globals.
40 clang_analyzer_eval(global
); // expected-warning{{UNKNOWN}}