Artem Dergachev | 1084de5 | 2018-01-17 22:58:35 +0000 | [diff] [blame] | 1 | // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -analyzer-config c++-allocator-inlining=true -std=c++11 -verify %s |
| 2 | |
| 3 | void clang_analyzer_eval(bool); |
| 4 | |
| 5 | typedef __typeof__(sizeof(int)) size_t; |
| 6 | |
| 7 | void *operator new(size_t size) throw() { |
| 8 | return nullptr; |
| 9 | } |
| 10 | void *operator new[](size_t size) throw() { |
| 11 | return nullptr; |
| 12 | } |
| 13 | |
| 14 | struct S { |
| 15 | int x; |
| 16 | S() : x(1) {} |
| 17 | ~S() {} |
| 18 | }; |
| 19 | |
| 20 | void testArrays() { |
| 21 | S *s = new S[10]; // no-crash |
| 22 | s[0].x = 2; // expected-warning{{Dereference of null pointer}} |
| 23 | } |